FirebaseFlagProvider class final

A FlagProvider backed by Firebase Remote Config.

final provider = FirebaseFlagProvider();
await FlagService.instance.configure(provider);

The fetchInterval governs how frequently refresh will actually hit the network (Firebase enforces a server-side throttle as well). During development you may lower minimumFetchInterval to Duration.zero.

Implemented types

Constructors

FirebaseFlagProvider({FirebaseRemoteConfig? remoteConfig, Duration fetchInterval = const Duration(hours: 1), Duration minimumFetchInterval = const Duration(minutes: 5)})
Creates a Firebase Remote Config provider.

Properties

hashCode int
The hash code for this object.
no setterinherited
lastFetchedAt DateTime?
The UTC time of the last successful fetch, or null if never fetched.
no setteroverride
providerId String
A stable identifier for this provider (e.g. 'firebase', 'mongo').
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getBool(String key, {required bool defaultValue}) bool
Returns a boolean flag value.
override
getDouble(String key, {required double defaultValue}) double
Returns a double flag value.
override
getInt(String key, {required int defaultValue}) int
Returns an integer flag value.
override
getJson(String key, {required Map<String, dynamic> defaultValue}) Map<String, dynamic>
Returns a JSON object flag value.
override
getString(String key, {required String defaultValue}) String
Returns a string flag value.
override
getValue<T>(String key, T defaultValue) → T
Returns the value for key, falling back to defaultValue if the key does not exist or has an incompatible type.
override
initialize() Future<void>
Initialises the provider (e.g. fetch + activate remote config).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() Future<void>
Requests a fresh value set from the remote source.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited