fetch method

Future<void> fetch({
  1. String? userId,
  2. String? deviceId,
  3. Map<String, dynamic>? userProperties,
})

Fetch an experiment or feature flag by user info

Implementation

Future<void> fetch({String? userId, String? deviceId, Map<String, dynamic>? userProperties}) async {
  final context = await _config?.exposureTrackingProvider?.getContext(_getInstanceName());

  final input = ExperimentFetchInput(userId: userId ?? context?.userId, deviceId: deviceId ?? context?.deviceId, userProperties: userProperties ?? context?.userProperties);

  await _httpClient.get(input, _config?.timeout);

  _log('[Experiment] Fetched ${_httpClient.fetchResult.length} experiment(s) for this user!');

  _storeVariants();
}