Files
momo/lib/models/login_resp.dart
2023-02-07 17:28:01 +08:00

28 lines
1.0 KiB
Dart

import 'package:json_annotation/json_annotation.dart';
/// This allows the `User` class to access private members in
/// the generated file. The value for this is *.g.dart, where
/// the star denotes the source file name.
part 'login_resp.g.dart';
/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class LoginResp {
LoginResp(this.token, this.msg);
String token;
String msg;
/// A necessary factory constructor for creating a new Configs instance
/// from a map. Pass the map to the generated `_$ConfigsFromJson()` constructor.
/// The constructor is named after the source class, in this case, Configs.
factory LoginResp.fromJson(Map<String, dynamic> json) =>
_$LoginRespFromJson(json);
/// `toJson` is the convention for a class to declare support for serialization
/// to JSON. The implementation simply calls the private, generated
/// helper method `_$LoginRespToJson`.
Map<String, dynamic> toJson() => _$LoginRespToJson(this);
}