FirebaseConfig.fromJson constructor
Creates a FirebaseConfig instance from a JSON map.
This factory constructor parses a JSON map and creates a corresponding FirebaseConfig object. It expects the JSON map to contain the keys 'apiKey', 'projectId', 'authDomain', 'storageBucket', 'messagingSenderId', 'appId', and 'measurementId'.
Example JSON:
{
"apiKey": "YOUR_API_KEY",
"projectId": "your-project-id",
"authDomain": "[invalid URL removed]",
"storageBucket": "[invalid URL removed]",
"messagingSenderId": "1234567890",
"appId": "1:1234567890:web:abcdef1234567890",
"measurementId": "G-ABCDEFGHIJ"
}
Throws a TypeError if the provided JSON values are not of the expected types.
Implementation
factory FirebaseConfig.fromJson(Map<String, dynamic> json) {
return FirebaseConfig(
apiKey: json['apiKey'] as String,
projectId: json['projectId'] as String,
authDomain: json['authDomain'] as String,
storageBucket: json['storageBucket'] as String,
messagingSenderId: json['messagingSenderId'] as String,
appId: json['appId'] as String,
measurementId: json['measurementId'] as String,
);
}