import 'package:json_annotation/json_annotation.dart'; part 'Result.g.dart'; @JsonSerializable() class Result { bool success; String error; String token; dynamic data; // list or map Result(this.success, this.error, this.data, this.token); Result.empty(); factory Result.fromJson(Map json) => _$ResultFromJson(json); Map toJson() => _$ResultToJson(this); }