toJson method
Implementation
Map<String, dynamic> toJson({
Map<String, dynamic> Function(T)? toJson,
}) {
return {
if (data != null) 'data': toJson != null ? toJson(data!) : data,
if (error != null) 'error': error,
if (message != null) 'message': message,
};
}