21 lines
551 B
Dart
21 lines
551 B
Dart
class Response<T> {
|
|
final T? body;
|
|
final int status;
|
|
final bool operation;
|
|
|
|
Response({this.body, required this.operation, required this.status});
|
|
|
|
factory Response.fromJson(Map<String, dynamic> data, Function parser) {
|
|
return Response(
|
|
body: parser(data['body']),
|
|
status: data['status'],
|
|
operation: data['operation']);
|
|
}
|
|
factory Response.fromJsonDynamic(Map<String, dynamic> data) {
|
|
return Response(
|
|
body: data['body'],
|
|
status: data['status'],
|
|
operation: data['operation']);
|
|
}
|
|
}
|