AvatarData.fromJson constructor
avatarDataId that contain String value of Avatar Image ID
Status
is contain Integer value
type ,accountId , id is contain String value
version , order ,v is contain integer value
FrontendConfig is contains object value
AvatarConfig is contains object value
createdAt, updatedAt is contains DateTime value
Parse it using the dart:convert package instead of json5.
Implementation
factory AvatarData.fromJson(Map<String, dynamic> json) => AvatarData(
avatarDataId: json["id"],
status: json["status"],
type: json["type"],
version: json["version"],
order: json["order"],
accountId: json["accountId"],
frontendConfig: json["frontendConfig"] == null
? null
: FrontendConfig.fromJson(json["frontendConfig"]),
avatarConfig: json["avatarConfig"] == null
? null
: AvatarConfig.fromJson(json["avatarConfig"]),
variants: json["variants"] == null
? []
: List<dynamic>.from(json["variants"]!.map((x) => x)),
id: json["_id"],
createdAt: json["createdAt"] == null
? null
: DateTime.parse(json["createdAt"]),
updatedAt: json["updatedAt"] == null
? null
: DateTime.parse(json["updatedAt"]),
v: json["__v"],
);