Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
n-bernat committed Sep 7, 2024
1 parent 1962cc1 commit 1024ad5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ flutter pub get
1. Create a class with your preferences:

```dart
import 'package:flutter_app_preferences/flutter_app_preferences.dart';
// A class that holds the preferences.
class AppPreferences extends BaseAppPreferences {
// An example that stores a boolean value.
Expand Down Expand Up @@ -93,7 +95,7 @@ Future<void> main() async {
```

3. Provide it everywhere in your app:
3. Provide and use it everywhere in your app:

- `provider`

Expand All @@ -105,7 +107,9 @@ runApp(
child: const MaterialApp(),
),
);
```

```dart
// Read all
final prefs = context.watch<AppPreferences>();
Expand All @@ -129,7 +133,9 @@ Future<void> main() async {
runApp(const MaterialApp());
}
```

```dart
// Write
AppPreferences.i.highContrast.value = true;
Expand Down

0 comments on commit 1024ad5

Please sign in to comment.