prepareJson method

Map<String, dynamic> prepareJson(
  1. Map json
)

Prepare the JSON to be used in the UserModel.fromJson method.

This method is used to map the customClaims field to the correct type. See also https://github.com/rrousselGit/freezed/issues/1118#issuecomment-2323540350

Implementation

Map<String, dynamic> prepareJson(Map json) {
  final mappedJson = Map<String, dynamic>.from(json);
  // also map the customClaims field
  mappedJson['customClaims'] = json['customClaims'] != null
      ? Map<String, dynamic>.from(json['customClaims'] as Map)
      : null;
  return mappedJson;
}