0

I am using Flutter State Restoration like below. I want to clear all data of the bucket but I am not able to find any method for that.

final restorationBucket = await WidgetsBinding.instance.restorationManager.rootBucket;

UnmanagedRestorationScope(
            bucket: restorationBucket,
            child: MyApp(),
          )

I am able to read write using

final restorationBucket = RestorationScope.of(context);
final a1 = restorationBucket?.read<String>('pre_test');
restorationBucket?.write('test', 'hello');

But I have no idea how to clear whole bucket. Any help is appreciated.

Note : I have tried using dispose() but it makes the bucket unusable and throws exception when try to use the bucket.

Shahbaz Hashmi
  • 2,631
  • 2
  • 26
  • 49

0 Answers0