apptimizeTestInfo property

Future<Map<String, ApptimizeTestInfo?>?> apptimizeTestInfo

Get information about all Apptimize A/B tests and Feature Flags that the device is enrolled in.

Returns a Map whose keys are the names of all A/B tests and Feature Flags the device is enrolled in, and whose values are ApptimizeTestInfo objects containing information about the test or feature flag. If this device is enrolled in no tests, an empty Map is returned. If startApptimize has not been called yet, null is returned.

Note This does not include information about Apptimize A/B tests or Feature Flags that are running but that the device is not enrolled in.

Implementation

static Future<Map<String, ApptimizeTestInfo?>?> get apptimizeTestInfo async {
  final Map<dynamic, dynamic>? result =
      await _channel.invokeMethod('getApptimizeTestInfo');

  if (result == null) {
    return null;
  }

  final entries = result.entries;
  Map<String, ApptimizeTestInfo?> apptimizeTestInfos =
      new Map<String, ApptimizeTestInfo?>();

  for (final e in entries) {
    final key = e.key;
    final value = e.value;
    if (!(key is String)) {
      developer.log(
          "Expected `String` key in entries of `getApptimizeTestInfo` response",
          name: Apptimize._logTag);
      continue;
    }

    if (!(value is Map)) {
      developer.log(
          "Expected `Map` value in entries of `getApptimizeTestInfo` response",
          name: Apptimize._logTag);
      continue;
    }

    apptimizeTestInfos[key] = ApptimizeTestInfo._fromMap(value);
  }

  return apptimizeTestInfos;
}