CredentialsProviders.fromJson constructor

CredentialsProviders.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory CredentialsProviders.fromJson(Map<String, Object?> json) {
  final providers = json.map((key, value) {
    if (value is! Map<String, Object?>) {
      throw ArgumentError.value(
        json,
        key,
        '${value.runtimeType} is not a Map',
      );
    }
    if (key == 'CognitoIdentity') {
      final configs = AWSConfigMap.fromJson(
        value,
        (json) =>
            CognitoIdentityCredentialsProvider.fromJson((json as Map).cast()),
      );
      return MapEntry(key, configs);
    }
    return MapEntry(key, SerializableMap(value));
  });
  return CredentialsProviders(providers);
}