-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5613aae
commit 0a34df3
Showing
7 changed files
with
94 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:sharezone/util/cache/streaming_key_value_store.dart'; | ||
|
||
class FeatureFlagl10n extends ChangeNotifier { | ||
FeatureFlagl10n(this.keyValueStore) { | ||
_subscription = keyValueStore | ||
.getBool('l10n_enabled', defaultValue: false) | ||
.listen((event) { | ||
final newValue = event == true; | ||
if (isl10nEnabled != newValue) { | ||
isl10nEnabled = newValue; | ||
notifyListeners(); | ||
} | ||
}); | ||
} | ||
|
||
final StreamingKeyValueStore keyValueStore; | ||
late StreamSubscription<bool> _subscription; | ||
bool isl10nEnabled = false; | ||
|
||
void toggle() { | ||
isl10nEnabled = !isl10nEnabled; | ||
keyValueStore.setBool('l10n_enabled', isl10nEnabled); | ||
notifyListeners(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
_subscription.cancel(); | ||
super.dispose(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters