diff --git a/README.md b/README.md index ab26e82..2963d79 100755 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ To get a hold of `StreamingSharedPreferences`, _await_ on `instance`: import 'package:streaming_shared_preferences/streaming_shared_preferences.dart'; ... +WidgetsFlutterBinding.ensureInitialized(); final preferences = await StreamingSharedPreferences.instance; ``` @@ -111,6 +112,7 @@ Now we can pass `MyAppSettings` down to the widgets that use it: ```dart Future main() async { + WidgetsFlutterBinding.ensureInitialized(); /// Obtain instance to streaming shared preferences, create MyAppSettings, and /// once that's done, run the app. final preferences = await StreamingSharedPreferences.instance; diff --git a/example/lib/main.dart b/example/lib/main.dart index 4dab742..5f76f4c 100755 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,6 +18,8 @@ class MyAppSettings { } Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + /// Obtain instance to streaming shared preferences, create MyAppSettings, and /// once that's done, run the app. final preferences = await StreamingSharedPreferences.instance;