FirebaseServiceAccountCredentials.fromJsonString constructor

FirebaseServiceAccountCredentials.fromJsonString(
  1. String jsonString
)

Creates a new instance of FirebaseServiceAccountCredentials from a JSON string.

The string is expected to follow the format described in FirebaseServiceAccountCredentials.fromJson.

Implementation

factory FirebaseServiceAccountCredentials.fromJsonString(
  final String jsonString,
) {
  final data = jsonDecode(jsonString);
  if (data is! Map<String, dynamic>) {
    throw const FormatException('Not a JSON (map) object');
  }

  return FirebaseServiceAccountCredentials.fromJson(data);
}