Skip to content

Commit

Permalink
Merge pull request #10 from mapgoblin/master
Browse files Browse the repository at this point in the history
adds ensureInitialized(); to readme and example
  • Loading branch information
roughike authored Dec 27, 2020
2 parents 34c97d6 + 29d7f4e commit a0862a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;
```

Expand Down Expand Up @@ -111,6 +112,7 @@ Now we can pass `MyAppSettings` down to the widgets that use it:

```dart
Future<void> 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;
Expand Down
2 changes: 2 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class MyAppSettings {
}

Future<void> 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;
Expand Down

0 comments on commit a0862a4

Please sign in to comment.