RemoteConfigService class

Remote config / feature-flag seam. The package pulls in no HTTP/Firebase SDK — a consuming app injects its own network call via fetchRemote (e.g. wrapping dio/http/Firebase Remote Config). init always loads the bundled asset fallback first so typed getters have something valid to return even before (or if) the network attempt resolves, then tries fetchRemote and MERGES its entries on top of the asset defaults key-by-key (ENH-58) — a partial response only overrides the keys it actually sends, every other key keeps its already-validated asset value. A null value for a key in the remote response is treated as "no override" (skipped) rather than "set this key to null", so a server that echoes back unset fields as null can't wipe a working default. A missing asset or a failing/absent fetchRemote is swallowed silently — this never throws, it just falls back to defaults.

Inheritance
  • Object
  • GetLifeCycle
  • DisposableInterface
  • GetxService
  • RemoteConfigService

Constructors

RemoteConfigService({required String assetPath, Future<Map<String, Object?>> fetchRemote()?, AssetBundle? bundle, Map<String, RemoteConfigKeySchema> schema = const {}})

Properties

fetchRemote → Future<Map<String, Object?>> Function()?
final
hashCode → int
The hash code for this object.
no setterinherited
initialized → bool
Checks whether the controller has already been initialized.
no setterinherited
isClosed → bool
Checks whether the controller has already been closed.
no setterinherited
onDelete → InternalFinalCallback<void>
Internal callback that starts the cycle of this controller.
finalinherited
onStart → InternalFinalCallback<void>
Called at the exact moment the widget is allocated in memory. It uses an internal "callable" type, to avoid any @overrides in subclases. This method should be internal and is required to define the lifetime cycle of the subclass.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schema → Map<String, RemoteConfigKeySchema>
Expected shape for any subset of remote-config keys (ENH-84) — left at its default {} (no key registered), init/initResult behave EXACTLY as before this param existed: fully backward compatible.
final
schemaViolations → List<String>
Violations found against schema the last time init ran — always empty when schema is empty (the default) or when the merged config matched it completely. init itself never throws on these (same never-throws contract as always); initResult is what turns a non-empty list into a reportable SdkFailure.
no setter
snapshot → Map<String, Object?>
Read-only view of the current merged config (ENH-58) — a defensive copy, so a caller can't mutate this service's internal state by holding onto and modifying the returned map.
no setter
source → RemoteConfigSource
Where snapshot's current contents actually came from (ENH-58).
no setter

Methods

$configureLifeCycle() → void
inherited
getBool(String key, {bool fallback = false}) → bool
getDouble(String key, {double fallback = 0}) → double
getInt(String key, {int fallback = 0}) → int
getString(String key, {String fallback = ''}) → String
init() → Future<void>
initResult() → Future<SdkResult<void>>
Unlike init (which never throws — a fetch failure just falls back to defaults, see the class doc), this DOES surface a failed remote fetch as an SdkFailure — a caller that wants to know "did boot actually succeed" shouldn't have to separately check source to notice the difference between "remote merged" and "silently fell back". init itself is unaffected: it still never throws and still sets source exactly as before — this only changes what initResult REPORTS about that outcome.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose() → void
Called before onDelete method. onClose might be used to dispose resources used by the controller. Like closing events, or streams before the controller is destroyed. Or dispose objects that can potentially create some memory leaks, like TextEditingControllers, AnimationControllers. Might be useful as well to persist some data on disk.
inherited
onInit() → void
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
inherited
onReady() → void
Called 1 frame after onInit(). It is the perfect place to enter navigation events, like snackbar, dialogs, or a new route, or async request.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

maybe → RemoteConfigService?
Null-safe accessor for call sites that may run before/without this service registered (mirrors AudioManager.maybe).
no setter