Skip to content

Commit

Permalink
Rewrite implementation to avoid unnecessary platform calls
Browse files Browse the repository at this point in the history
  • Loading branch information
collinjackson committed Aug 25, 2019
1 parent ae4db9a commit 2e228e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/firebase_remote_config/lib/src/remote_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class RemoteConfig extends ChangeNotifier {
/// Gets the instance of RemoteConfig for the default Firebase app.
static Future<RemoteConfig> get instance async {
if (!_instanceCompleter.isCompleted) {
_getRemoteConfigInstance();
_instanceCompleter.complete(await _getRemoteConfigInstance());
}
return _instanceCompleter.future;
}

static void _getRemoteConfigInstance() async {
static Future<RemoteConfig> _getRemoteConfigInstance() async {
final Map<String, dynamic> properties =
await channel.invokeMapMethod<String, dynamic>('RemoteConfig#instance');

Expand All @@ -53,7 +53,7 @@ class RemoteConfig extends ChangeNotifier {
instance._remoteConfigSettings = remoteConfigSettings;
instance._parameters =
_parseRemoteConfigParameters(parameters: properties['parameters']);
_instanceCompleter.complete(instance);
return instance;
}

static Map<String, RemoteConfigValue> _parseRemoteConfigParameters(
Expand Down

0 comments on commit 2e228e4

Please sign in to comment.