fromJson method

  1. @override
IdentityState? 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
IdentityState? fromJson(Map<String, dynamic> json) {
  return const IdentityState().copyWith(
    isLoggedIn: json['isLoggedIn'] ?? false,
    user: json.containsKey('user') ? User.fromJson(json['user']) : null,
  );
}