fetchFlags method

Future<void> fetchFlags()

Implementation

Future<void> fetchFlags() async {
  /// Delegate the action to strategy
  this.flagStatus = FlagStatus.FETCHING;
  return _visitorDelegate.fetchFlags().then((fetchResponse) {
    if (fetchResponse?.error == null) {
      _flagSyncStatus = FlagSyncStatus.FLAGS_FETCHED;
      this.flagStatus =
          fetchResponse?.fetchStatus ?? FlagStatus.FETCH_REQUIRED;
      this._fetchReasons = FetchFlagsRequiredStatusReason.NONE;
    } else {
      this.flagStatus =
          fetchResponse?.fetchStatus ?? FlagStatus.FETCH_REQUIRED;
      this._fetchReasons =
          FetchFlagsRequiredStatusReason.FLAGS_FETCHING_ERROR;
    }
  });
}