RemoteConfigGist class

A class that manages remote configuration using GitHub Gists.

This class provides functionality to:

  • Fetch remote configuration from a GitHub Gist
  • Cache configuration locally
  • Manage fetch intervals and timeouts
  • Handle fetch failures with fallback to cached or default values

Example usage:

final config = RemoteConfigGist(
  gistId: 'your_gist_id',
  filename: 'config.json',
  defaultConfig: {'welcome_message': 'Hello'},
);

final configValues = await config.fetchConfig();
await config.activate();

final message = config.getValue<String>('welcome_message', 'Default');

Constructors

RemoteConfigGist({required String gistId, required String filename, Map<String, dynamic> defaultConfig = const {}, Duration fetchInterval = const Duration(hours: 1), Duration timeout = const Duration(seconds: 10)})

Properties

defaultConfig Map<String, dynamic>
final
fetchInterval Duration
final
filename String
final
gistId String
final
hashCode int
The hash code for this object.
no setterinherited
lastFetchStatus RemoteConfigStatus
no setter
lastFetchTime DateTime?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeout Duration
final

Methods

activate() Future<bool>
clearCache() Future<void>
fetchConfig({bool forceRefresh = false}) Future<Map<String, dynamic>>
getValue<T>(String key, T defaultValue) → T
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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