getKeys method

  1. @visibleForTesting
Future<void> getKeys()
inherited

A function that preloads this Stream with keys that match regex, sharedBy, and sharedWith.

This calls handleNotification with the 'init' operation.

Implementation

@visibleForTesting
Future<void> getKeys() async {
  _logger.finer('getting keys');
  AtClient atClient = _atClientManager.atClient;
  List<AtKey> keys = await atClient.getAtKeys(
    regex: regex,
    sharedBy: sharedBy,
    sharedWith: sharedWith,
  );

  for (AtKey key in keys) {
    await atClient
        .get(key)
        .then(
          // ignore: unnecessary_cast
          (AtValue value) {
            _logger.finest(
                'handleNotification key: $key, value: $value, operation: init');
            handleNotification(key, value, 'init');
          } as void Function(AtValue),
        )
        .catchError(onError);
  }
}