toMap method Null safety
Return a map representation of this error suitable for converstion to json.
Implementation
Map<String, dynamic> toMap() {
Map<String, dynamic> map = {
'code': code,
'message': message,
};
if (data != null) {
map['data'] = data;
}
return map;
}