LaunchdarklyFlutter class

Client for accessing LaunchDarkly's Feature Flag system.

Constructors

LaunchdarklyFlutter({Map<String, void Function(String?)>? flagListeners, Map<String, void Function(List<String>)>? allFlagsListeners})
Constructor for the Client for accessing LaunchDarkly's Feature Flag system. The main entry point. flagListeners (optional) is the map of flag keys and callbacks.

Properties

allFlagsListeners Map<String, void Function(List<String>)>?
getter/setter pair
flagListeners Map<String, void Function(String?)>?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allFlags() Future<Map<String, dynamic>>
Returns a map of all feature flags for the current user. No events are sent to LaunchDarkly.
boolVariation(String flagKey, bool? fallback) Future<bool?>
Returns the flag value for the current user. Returns 'fallback' when one of the following occurs:
handlerMethodCalls(MethodCall call) Future
identify(String? userKey, {LaunchDarklyUser? user, Map<String, dynamic>? custom, Map<String, dynamic>? privateCustom}) Future<bool?>
Changes user context.
init(String? mobileKey, String? userKey, {LaunchDarklyConfig? config, LaunchDarklyUser? user, Map<String, dynamic>? custom, Map<String, dynamic>? privateCustom}) Future<bool?>
Initializes and blocks for up to 5 seconds until the client has been initialized. If the client does not initialize within 5 seconds, it is returned anyway and can be used, but may not have fetched the most recent feature flag values. mobileKey is the mobile key from your Environments page in LaunchDarkly. Additional configuration can be set via the optional config. userKey is the user id considered by LaunchDarkly for feature flag targeting and rollouts. The userKey should also uniquely identify each user. You can use a primary key, an e-mail address, or a hash, as long as the same user always has the same key. We recommend using a hash if possible. You can also distinguish logged-in users from anonymous users in the SDK by leaving the userKey parameter null. You can pass built-in user attributes as LaunchDarklyUser in user. You can pass custom attributes and private custom attributes in custom and privateCustom maps accordingly. Please note private attributes take precedence over non-private ones.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerAllFlagsListener(String? listenerId, void callback(List<String>)?) Future<bool?>
Registers a callback to be called when a flag update is processed by the SDK.
registerFeatureFlagListener(String? flagKey, void callback(String?)?) Future<bool?>
Registers a callback to be called when the flagKey changes from its current value. If the feature flag is deleted, the listener will be unregistered.
stringVariation(String flagKey, String? fallback) Future<String?>
Returns the flag value for the current user. Returns 'fallback' when one of the following occurs:
toString() String
A string representation of this object.
inherited
unregisterAllFlagsListener(String? listenerId) Future<bool?>
Unregisters a callback so it will no longer be called on flag updates.
unregisterFeatureFlagListener(String? flagKey) Future<bool?>
Unregisters the existing callback for the flagKey.

Operators

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