Remote Config
Typed parameters with ordered conditions, versioned publishing and rollback — change behaviour without a release.
Remote Config holds typed parameters — strings, numbers, booleans, JSON — whose value can depend on conditions: platform, app version, country, language, a percentile rollout, or any custom attribute you send. You edit a draft, publish it as a new version, and can roll back to any earlier one.
Conditions are ordered — the first match wins. Evaluation happens on the server, so the SDK receives final values only.
Defaults, fetch, read
await Nexus.init(const NexusConfig(
apiKey: 'nxs_live_xxx',
remoteConfigEnabled: true, // fetch at startup + on foreground
remoteConfigDefaults: {'welcome': 'Hi', 'max_items': 10},
));
final rc = Nexus.instance.remoteConfig;
await rc.fetch(); // fetch + activate now
rc.getString('welcome'); // '' fallback
rc.getInt('max_items'); rc.getDouble('price'); rc.getBool('maintenance');
rc.getJson('theme'); // Map / List
rc.sourceOf('welcome'); // condition name, or null for the default
rc.version; rc.lastFetchTime;Always register defaults
Defaults are what keep a config outage — or a missing key — from changing your
app's behaviour. Without one a missing key reads as 0, false or "".
Custom attributes
Send any primitive key/value and target it with a Custom attribute condition.
rc.setAttribute('governorate', 'Erbil'); // persistent, sent on every fetch
rc.setAttributes({'plan': 'pro', 'segment': 'beta'});
await rc.fetch(attributes: {'governorate': 'Duhok'}); // this fetch only
rc.clearAttributes();Precedence (later wins): defaultProperties → identity traits → setAttributes →
per-fetch attributes. Platform, app version, country and language are filled in
automatically.
Values must be primitives and match the condition value exactly (case-sensitive). If a condition "doesn't work", log what the device sends.
Live updates
With a realtime connection, SDKs re-fetch the moment you publish:
await Nexus.init(const NexusConfig(apiKey: '…', remoteConfigEnabled: true, remoteConfigRealtime: true));
final sub = Nexus.instance.remoteConfig.onChange.listen((_) => setState(() {}));await nexus.realtime.connect();
await nexus.remoteConfig.subscribeRealtime(nexus.realtime);Writing from a server
Server SDKs can edit the draft and publish — useful for scripted changes. Nothing changes for anyone until you publish.
rc.set_parameter("fee_percent", 2.5, description="Checkout fee")
rc.delete_parameter("legacy_flag")
rc.publish("raise the fee")
rc.set("phone_number", "+9647500000000") # set + publish in one stepVersions & rollback
Every publish creates a version with its message. In Remote Config → Versions you can inspect any version and roll back to it — a rollback is itself a new version, so history is never lost. Preview evaluates the draft against a hypothetical device before you publish.
