InvergeDocs
FlutterAPI reference

Remote Config

Remote Config in the Flutter SDK.

import 'package:nexus_flutter/nexus.dart';

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');
View source

onChange

property
Stream<void> get onChange

Emits after every fetch that changes the active values.

View source

version

property
int get version

The active template version last fetched (0 until first fetch).

View source

lastFetchTime

property
DateTime? get lastFetchTime
View source

attributes

property
Map<String, Object?> get attributes

The custom targeting attributes currently sent with fetches.

View source

setDefaults()

method
void setDefaults(Map<String, Object?> defaults)

Set in-app fallback values (used until the server provides a value). Merges with any existing defaults. Mirrors Firebase setDefaults.

Parameters

Prop

Type

View source

setAttributes()

method
void setAttributes(Map<String, Object?> attributes)

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.

Parameters

Prop

Type

View source

setAttribute()

method
void setAttribute(String key, Object? value)

Set (or replace) a single custom targeting attribute. Pass null to remove.

Parameters

Prop

Type

View source

clearAttributes()

method
void clearAttributes()
View source

fetch()

method
Future<bool> fetch({Map<String, Object?>? attributes})

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.

Parameters

Prop

Type

Returns Future<bool>

View source

getValue()

method
Object? getValue(String key)

The raw value for key (server value, else in-app default, else null).

Parameters

Prop

Type

Returns Object?

View source

getString()

method
String getString(String key, [String fallback = ''])

Parameters

Prop

Type

Returns String

View source

getBool()

method
bool getBool(String key, [bool fallback = false])

Parameters

Prop

Type

Returns bool

View source

getInt()

method
int getInt(String key, [int fallback = 0])

Parameters

Prop

Type

Returns int

View source

getDouble()

method
double getDouble(String key, [double fallback = 0])

Parameters

Prop

Type

Returns double

View source

getJson()

method
Object? getJson(String key, [Object? fallback])

A JSON value (Map/List) for key, or fallback when absent.

Parameters

Prop

Type

Returns Object?

View source

sourceOf()

method
String? sourceOf(String key)

The condition that supplied key's value (null when the default applied).

Parameters

Prop

Type

Returns String?

View source

getAll()

method
Map<String, Object?> getAll()

Every currently-active key → value (server values overlaid on defaults).

Returns Map<String, Object?>

View source

subscribeRealtime()

method
Future<void> subscribeRealtime(NexusRealtime realtime)

Subscribe to server-pushed config updates: on a new publish, re-fetch. Requires an active realtime connection. Safe to call more than once.

Parameters

Prop

Type

View source

unsubscribeRealtime()

method
Future<void> unsubscribeRealtime()
View source

dispose()

method
void dispose()
View source

On this page