35 lines
736 B
Dart
35 lines
736 B
Dart
import 'package:satu/core/utils/utils_parse.dart';
|
|
|
|
/// list : []
|
|
/// message : ""
|
|
/// operation : true
|
|
|
|
class Response {
|
|
List? list;
|
|
String? message;
|
|
bool? operation;
|
|
|
|
Response();
|
|
|
|
factory Response.fromMapList(dynamic map, Function(dynamic)? parser) {
|
|
|
|
final List list = [];
|
|
if (map['list'] != null) {
|
|
(map['list'] as List).forEach((dynamic element) {
|
|
if(parser == null) {
|
|
list.add(element);
|
|
} else {
|
|
list.add(parser(element));
|
|
}
|
|
});
|
|
}
|
|
final Response responseBean = Response();
|
|
responseBean.list = list;
|
|
responseBean.message = cast<String>(map['message']);
|
|
responseBean.operation = map['operation'] as bool;
|
|
return responseBean;
|
|
}
|
|
|
|
|
|
}
|