fromJson method

  1. @override
ThemeMode? fromJson(
  1. Map<String, dynamic> json
)

Responsible for converting the Map<String, dynamic> representation of the bloc state into a concrete instance of the bloc state.

Implementation

@override
ThemeMode? fromJson(Map<String, dynamic> json) {
  try {
    return ThemeMode.values.firstWhere((e) => e.toString() == json['value']);
  } catch (_) {
    return ThemeMode.system;
  }
}