StorageAdapterScope constructor

const StorageAdapterScope({
  1. Key? key,
  2. required Widget child,
  3. required StorageAdapter adapter,
})

StorageAdapter for the entire app by placing it on top of MaterialApp, etc.

Pass StorageAdapter to adapter.

Also, by using StorageAdapterScope.of in a descendant widget, you can retrieve the StorageAdapter set in the StorageAdapterScope.

MaterialAppなどの上に配置して、アプリ全体にStorageAdapterを設定します。

adapterStorageAdapterを渡してください。

またStorageAdapterScope.ofを子孫のウィジェット内で利用することによりStorageAdapterScopeで設定されたStorageAdapterを取得することができます。

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return StorageAdapterScope(
      adapter: const RuntimeStorageAdapter(),
      child: MaterialApp(
        home: const StoragePage(),
      ),
    );
  }
}

Implementation

const StorageAdapterScope({
  super.key,
  required this.child,
  required this.adapter,
});