OAuth2Google.fromMap constructor

OAuth2Google.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory OAuth2Google.fromMap(
  Map<String, dynamic> map,
) {
  map = {
    '\$id': "",
    'enabled': false,
    'clientId': "",
    'clientSecret': "",
    'prompt': ["consent"],
    'nativeEnabled': false,
    'nativeClientIds': [],
    ...map,
  };

  return OAuth2Google(
    $id: map['\$id'].toString(),
    enabled: map['enabled'],
    clientId: map['clientId'].toString(),
    clientSecret: map['clientSecret'].toString(),
    prompt: List<enums.OAuth2GooglePrompt>.from(
      ((map['prompt'] is List) ? map['prompt'] : [map['prompt']]).map(
        (p) =>
            enums.OAuth2GooglePrompt.values.firstWhere((e) => e.value == p),
      ),
    ),
    nativeEnabled: map['nativeEnabled'],
    nativeClientIds: List.from(map['nativeClientIds'] ?? []),
  );
}