fromJson static method
Implementation
static ServiceRunAs? fromJson(Object? value) {
if (value == null) {
return null;
}
if (value is Map) {
final json = Map<String, dynamic>.from(value);
final rawEmail = json['email'];
if (rawEmail is! String) {
throw const FormatException('container.run_as.email is required');
}
final email = rawEmail.trim().toLowerCase();
if (email.isEmpty) {
throw const FormatException('container.run_as.email is required');
}
final rawScopes = json['scopes'];
return ServiceRunAs(email: email, scopes: rawScopes == null ? null : (rawScopes as List).map((entry) => entry as String).toList());
}
throw const FormatException('container.run_as must be an object');
}