RemoteSetting.fromJson constructor

RemoteSetting.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory RemoteSetting.fromJson(Map<String, dynamic> json) {
  return RemoteSetting(
    key: json['key'] as String,
    value: json['value'],
    source: RemoteSettingsSource.values.firstWhere(
      (s) => s.name == json['source'],
      orElse: () => RemoteSettingsSource.custom,
    ),
    lastFetched: DateTime.parse(json['lastFetched'] as String),
    expiresAt: json['expiresAt'] != null
        ? DateTime.parse(json['expiresAt'] as String)
        : null,
    overridable: json['overridable'] as bool? ?? true,
  );
}