InMemoryProvider class

An in-memory feature flag provider for testing and local development.

This provider allows you to set, update, and remove feature flags at runtime, storing them in a simple in-memory map. It is useful for unit tests and local development scenarios where you want to quickly change flag values without external dependencies.

Whenever the flag configuration changes, a PROVIDER_CONFIGURATION_CHANGED event is emitted via the events stream.

Implemented types

Constructors

InMemoryProvider({Map<String, dynamic>? initialFlags})
Optional constructor to pre-seed flags.

Properties

config ProviderConfig
no setteroverride
events Stream<IntelliToggleEvent>
Listen to provider events (e.g., configuration changed).
no setter
hashCode int
The hash code for this object.
no setterinherited
metadata ProviderMetadata
no setteroverride
name String
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ProviderState
no setteroverride

Methods

clearFlags() → void
Clear all flags.
connect() Future<void>
override
getBooleanFlag(String flagKey, bool defaultValue, {Map<String, dynamic>? context}) Future<FlagEvaluationResult<bool>>
Resolve a boolean flag.
override
getDoubleFlag(String flagKey, double defaultValue, {Map<String, dynamic>? context}) Future<FlagEvaluationResult<double>>
Resolve a double flag.
override
getIntegerFlag(String flagKey, int defaultValue, {Map<String, dynamic>? context}) Future<FlagEvaluationResult<int>>
Resolve an integer flag.
override
getObjectFlag(String flagKey, Map<String, dynamic> defaultValue, {Map<String, dynamic>? context}) Future<FlagEvaluationResult<Map<String, dynamic>>>
Resolve an object flag (Map).
override
getStringFlag(String flagKey, String defaultValue, {Map<String, dynamic>? context}) Future<FlagEvaluationResult<String>>
Resolve a string flag.
override
hasFlag(String key) bool
Returns true if a flag with key exists in the provider.
initialize([Map<String, dynamic>? context]) Future<void>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeFlag(String key) → void
Remove a flag by key.
setFlag(String key, dynamic value) → void
Set or update a flag value.
shutdown() Future<void>
override
toString() String
A string representation of this object.
inherited
track(String trackingEventName, {Map<String, dynamic>? evaluationContext, TrackingEventDetails? trackingDetails}) Future<void>
Tracking API (spec Section 6) - silent no-op for in-memory provider
override

Operators

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