Skip to content

Instantly share code, notes, and snippets.

@vaygeth89
Created October 23, 2021 11:38
Show Gist options
  • Save vaygeth89/12bcc3402901ea8ada377c00352f84d0 to your computer and use it in GitHub Desktop.
Save vaygeth89/12bcc3402901ea8ada377c00352f84d0 to your computer and use it in GitHub Desktop.
Serialized model
//Add this
import 'package:json_annotation/json_annotation.dart';
//Add this
part 'business_error.g.dart';
//Add this
@JsonSerializable()
class BusinessError {
final String message;
final int? businessError;
BusinessError({
required this.message,
this.businessError,
});
//Add this
static BusinessError fromJson(Map<String, dynamic> map) =>
_$BusinessErrorFromJson(map);
Map<String, dynamic> toJson() => _$BusinessErrorToJson(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment