NexusRemoteConfig class

Firebase-style Remote Config. Fetches the active template for this app instance, resolves conditional values server-side, and exposes typed getters with in-app defaults as the fallback.

nexus.remoteConfig.setDefaults({'welcome': 'Hi', 'max_items': 10});
await nexus.remoteConfig.fetch();
final msg = nexus.remoteConfig.getString('welcome');

Constructors

NexusRemoteConfig(NexusHttp _http, NexusIdentity _id, NexusConfig _cfg)

Properties

attributes → Map<String, Object?>
The custom targeting attributes currently sent with fetches.
no setter
hashCode → int
The hash code for this object.
no setterinherited
lastFetchTime → DateTime?
no setter
onChange → Stream<void>
Emits after every fetch that changes the active values.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
version → int
The active template version last fetched (0 until first fetch).
no setter

Methods

clearAttributes() → void
dispose() → void
fetch({Map<String, Object?>? attributes}) → Future<bool>
Fetch the active template and activate it. Returns true when the values changed since the last fetch. attributes are merged (for this fetch only) over the persistent ones set via setAttributes. Best-effort — never throws.
getAll() → Map<String, Object?>
Every currently-active key → value (server values overlaid on defaults).
getBool(String key, [bool fallback = false]) → bool
getDouble(String key, [double fallback = 0]) → double
getInt(String key, [int fallback = 0]) → int
getJson(String key, [Object? fallback]) → Object?
A JSON value (Map/List) for key, or fallback when absent.
getString(String key, [String fallback = '']) → String
getValue(String key) → Object?
The raw value for key (server value, else in-app default, else null).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAttribute(String key, Object? value) → void
Set (or replace) a single custom targeting attribute. Pass null to remove.
setAttributes(Map<String, Object?> attributes) → void
Custom targeting attributes sent with every fetch (e.g. governorate, plan, segment). These feed "Custom attribute" conditions on the server. Merges with existing attributes; call clearAttributes to reset. Mirrors Firebase custom signals. Values must be string/number/bool.
setDefaults(Map<String, Object?> defaults) → void
Set in-app fallback values (used until the server provides a value). Merges with any existing defaults. Mirrors Firebase setDefaults.
sourceOf(String key) → String?
The condition that supplied key's value (null when the default applied).
subscribeRealtime(NexusRealtime realtime) → Future<void>
Subscribe to server-pushed config updates: on a new publish, re-fetch. Requires an active realtime connection. Safe to call more than once.
toString() → String
A string representation of this object.
inherited
unsubscribeRealtime() → Future<void>

Operators

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