Line data Source code
1 : import 'package:json_annotation/json_annotation.dart'; 2 : part 'error.g.dart'; 3 : 4 : @JsonSerializable(createFactory: true) 5 : class Error implements Exception { 6 : @JsonKey(name: 'error_message') 7 : final String errorMessage; 8 : @JsonKey(name: 'error_code') 9 : final int errorCode; 10 : final Map errors; 11 1 : Error({this.errorMessage, this.errorCode, this.errors}); 12 2 : factory Error.fromJson(Map<String, dynamic> json) => _$ErrorFromJson(json); 13 2 : Map<String, dynamic> toJson() => _$ErrorToJson(this); 14 : }