AbiBaseFragment.fromJson constructor
Creates an instance of AbiBaseFragment from JSON representation.
Implementation
factory AbiBaseFragment.fromJson(Map<String, dynamic> json, bool tronTypes) {
final type = FragmentTypes.fromName(json["type"]);
switch (type) {
case FragmentTypes.event:
return AbiEventFragment.fromJson(json, tronTypes);
case FragmentTypes.function:
return AbiFunctionFragment.fromJson(json, tronTypes);
case FragmentTypes.receive:
return AbiReceiveFragment.fromJson(json);
case FragmentTypes.constructor:
return AbiConstructorFragment.fromJson(json, tronTypes);
case FragmentTypes.fallback:
return AbiFallbackFragment.fromJson(json, tronTypes);
case FragmentTypes.error:
return AbiErrorFragment.fromJson(json, tronTypes);
default:
throw MessageException("unsupported fragment $type");
}
}