Commit 496de6de authored by 林生雨's avatar 林生雨

commit

parent 0d25bc98
sdk.dir=/Users/apple/Library/Android/sdk sdk.dir=/Users/apple/Library/Android/sdk
flutter.sdk=/Users/apple/Downloads/flutter flutter.sdk=/Users/apple/Downloads/flutter
flutter.buildMode=release flutter.buildMode=debug
flutter.versionName=1.0.0 flutter.versionName=1.0.0
flutter.versionCode=1 flutter.versionCode=1
\ No newline at end of file
...@@ -31,21 +31,29 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> { ...@@ -31,21 +31,29 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
final metadata = annometadata.computeConstantValue(); final metadata = annometadata.computeConstantValue();
if (metadata.type.name == "Post" || metadata.type.name == "Get") { if (metadata.type.name == "Post" || metadata.type.name == "Get") {
if (!differentList.contains(methodElement.returnType.name)) { if (!differentList.contains(methodElement.returnType.name)) {
var pathSegments = buildStep.inputId.pathSegments; if(methodElement.returnType.name=="SimpleResponce"){
StringBuffer path = new StringBuffer(); improtBuffer.write(
for (int i = 0; i < pathSegments.length; i++) { "import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';\n");
if (i < pathSegments.length - 2&& pathSegments[i] != "lib") { }else {
path.write("${pathSegments[i]}/"); var pathSegments = buildStep.inputId.pathSegments;
StringBuffer path = new StringBuffer();
for (int i = 0; i < pathSegments.length; i++) {
if (i < pathSegments.length - 2 && pathSegments[i] != "lib") {
path.write("${pathSegments[i]}/");
}
} }
improtBuffer.write(
"import 'package:${buildStep.inputId.package}/${path
.toString()}entity/${methodElement.returnType
.name}.dart\';\n");
} }
improtBuffer.write(
"import 'package:${buildStep.inputId.package}/${path.toString()}entity/${methodElement.returnType.name}.dart\';\n");
differentList.add(methodElement.returnType.name); differentList.add(methodElement.returnType.name);
} }
String tempParams; String tempParams;
String sendType = metadata.type.name == "Post" ? "post" : "get"; String sendType = metadata.type.name == "Post" ? "post" : "get";
mapBuffer.write(""" mapBuffer.write("""
return Observable.fromFuture(DioUtil().${sendType}(\'${metadata.getField("sufUrl").toStringValue()}\',data:{ return Observable.fromFuture(DioUtil().${sendType}(\'${metadata.getField("sufUrl").toStringValue()}\'
"""); """);
bool needMap = false; bool needMap = false;
for (int i = 0; i < methodElement.parameters.length; i++) { for (int i = 0; i < methodElement.parameters.length; i++) {
...@@ -60,9 +68,17 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> { ...@@ -60,9 +68,17 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
} else { } else {
tempParams = "${tempParams},${paramsMeta}"; tempParams = "${tempParams},${paramsMeta}";
} }
if (i == methodElement.parameters.length - 1) { if(i==0){
mapBuffer.write( mapBuffer.write(
"\'${queryAnno.getField("params").toStringValue()}\':${paramsMeta.name}"); ",data:{\'${queryAnno.getField("params").toStringValue()}\':${paramsMeta.name}");
if(methodElement.parameters.length>1){
mapBuffer.write(",");
}else{
mapBuffer.write("}");
}
}else if (i == methodElement.parameters.length - 1) {
mapBuffer.write(
"\'${queryAnno.getField("params").toStringValue()}\':${paramsMeta.name}}");
} else { } else {
mapBuffer.write( mapBuffer.write(
"\'${queryAnno.getField("params").toStringValue()}\':${paramsMeta.name},"); "\'${queryAnno.getField("params").toStringValue()}\':${paramsMeta.name},");
...@@ -70,7 +86,7 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> { ...@@ -70,7 +86,7 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
} }
} }
} }
mapBuffer.write("}))"); mapBuffer.write("))");
mapBuffer.write(""" mapBuffer.write("""
.map((value){ .map((value){
if(value.statusCode==200){ if(value.statusCode==200){
...@@ -98,6 +114,20 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> { ...@@ -98,6 +114,20 @@ class ServiceGenerator extends GeneratorForAnnotation<ServiceCenter> {
${improtBuffer.toString()} ${improtBuffer.toString()}
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';\n import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';\n
class ${element.displayName}Impl{ class ${element.displayName}Impl{
factory ${element.displayName}Impl() => _sharedInstance();
static ${element.displayName}Impl _instance;
${element.displayName}Impl._() {
}
static ${element.displayName}Impl _sharedInstance() {
if (_instance == null) {
_instance = ${element.displayName}Impl._();
}
return _instance;
}
${methodBuffer.toString()} ${methodBuffer.toString()}
} }
"""; """;
......
/*
* @author lsy
* @date 2019-09-05
**/
import 'dart:async';
import 'package:rxdart/rxdart.dart';
abstract class BaseModel {
//TODO
void dispose();
}
/*
* @author lsy
* @date 2019-09-05
**/
import 'dart:async';
class LiveData<T> {
StreamController<T> _controller;
T data;
LiveData() {
this._controller = new StreamController<T>();
}
get stream => _controller.stream;
get controller => _controller;
void notifyView(T t) {
this.data = t;
_controller.sink.add(t);
}
void dispost() {
_controller.close();
}
}
...@@ -255,12 +255,12 @@ class DioUtil { ...@@ -255,12 +255,12 @@ class DioUtil {
/* /*
* post请求 * post请求
*/ */
post(url, {data, options, cancelToken}) async { Future<Response> post(url, {data, options, cancelToken}) async {
Response response; Response response;
try { try {
response = await _dio.post(url, response = await _dio.post(url,
queryParameters: data, options: options, cancelToken: cancelToken); queryParameters: data, options: options, cancelToken: cancelToken);
print('post success---------${response.data}'); print('post success---------${response.statusCode} ${response.data}');
} on DioError catch (e) { } on DioError catch (e) {
print('post error---------$e'); print('post error---------$e');
formatError(e); formatError(e);
......
/*
* @author lsy
* @date 2019-09-05
**/
class SimpleResponce {
Null data;
int errorCode;
String errorMsg;
SimpleResponce({this.data, this.errorCode, this.errorMsg});
SimpleResponce.fromJson(Map<String, dynamic> json) {
data = json['data'];
errorCode = json['errorCode'];
errorMsg = json['errorMsg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['data'] = this.data;
data['errorCode'] = this.errorCode;
data['errorMsg'] = this.errorMsg;
return data;
}
}
\ No newline at end of file
...@@ -56,11 +56,16 @@ class _MyAppState extends State<MyApp> { ...@@ -56,11 +56,16 @@ class _MyAppState extends State<MyApp> {
routes: { routes: {
// '/': (context) => CommentSuggest({"Cookie":" _gm_token=7e48641558699683; sessionid=nb3ze4ur7ucosln8sd8pzwojddenv9ym; _gtid=a1bc0a387e1911e996b9525400fa516d4094"}), // '/': (context) => CommentSuggest({"Cookie":" _gm_token=7e48641558699683; sessionid=nb3ze4ur7ucosln8sd8pzwojddenv9ym; _gtid=a1bc0a387e1911e996b9525400fa516d4094"}),
'/': (context) { '/': (context) {
var findMessageRouter = RouterCenterImpl().findMessageRouter(); // var findMessageRouter = RouterCenterImpl().findMessageRouter();
if (findMessageRouter == null) { // if (findMessageRouter == null) {
return null; // return null;
} // }
return findMessageRouter.getMessagePage({}); // return findMessageRouter.getMessagePage({});
var findUserRouter = RouterCenterImpl().findUserRouter();
if(findUserRouter==null){
return null;
}
return findUserRouter.getUserPage();
}, },
}, },
//调试的时候可以打开 //调试的时候可以打开
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* @date 2019-09-03 * @date 2019-09-03
**/ **/
import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/Annotations/RouterBaser.dart'; import 'package:gmalpha_flutter/Annotations/RouterBaser.dart';
import 'package:gmalpha_flutter/Annotations/anno/Router.dart'; import 'package:gmalpha_flutter/Annotations/anno/Router.dart';
import 'package:gmalpha_flutter/userModel/UserRouterImpl.dart'; import 'package:gmalpha_flutter/userModel/UserRouterImpl.dart';
...@@ -10,4 +11,5 @@ import 'package:gmalpha_flutter/userModel/UserRouterImpl.dart'; ...@@ -10,4 +11,5 @@ import 'package:gmalpha_flutter/userModel/UserRouterImpl.dart';
@Router("userModel",UserRouterImpl) @Router("userModel",UserRouterImpl)
abstract class UserRouter implements RouterBaser{ abstract class UserRouter implements RouterBaser{
Widget getUserPage();
} }
\ No newline at end of file
...@@ -2,8 +2,13 @@ ...@@ -2,8 +2,13 @@
* @author lsy * @author lsy
* @date 2019-09-03 * @date 2019-09-03
**/ **/
import 'package:flutter/src/widgets/framework.dart';
import 'package:gmalpha_flutter/userModel/UserRouter.dart'; import 'package:gmalpha_flutter/userModel/UserRouter.dart';
import 'package:gmalpha_flutter/userModel/page/user/UserPage.dart';
class UserRouterImpl implements UserRouter{ class UserRouterImpl implements UserRouter {
@override
} Widget getUserPage() {
\ No newline at end of file return UserWidget();
}
}
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
* @author lsy * @author lsy
* @date 2019-09-04 * @date 2019-09-04
**/ **/
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/userModel/page/user/UserPageModel.dart'; import 'package:gmalpha_flutter/userModel/page/user/UserPageModel.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
class UserWidget extends StatefulWidget { class UserWidget extends StatefulWidget {
@override @override
...@@ -13,20 +17,121 @@ class UserWidget extends StatefulWidget { ...@@ -13,20 +17,121 @@ class UserWidget extends StatefulWidget {
class UserState extends State<UserWidget> { class UserState extends State<UserWidget> {
UserPageModel _model; UserPageModel _model;
TextEditingController _nameController = new TextEditingController();
TextEditingController _wordController = new TextEditingController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_model = new UserPageModel(); _model = new UserPageModel();
} }
@override
void dispose() {
super.dispose();
_model.dispose();
_wordController.dispose();
_nameController.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return Scaffold( return Scaffold(
// body: ALRootInheritWideget( appBar: AppBar(
// model: _model, title: Text(
// child: Center( "User",
// child: Text(_model.text), style: TextStyle(fontSize: 16),
// ), ),
// )); centerTitle: true,
),
body: Column(
children: <Widget>[
Expanded(
child: StreamBuilder<SimpleResponce>(
stream: _model.logoutLive.stream,
initialData: _model.logoutLive.data,
builder: (BuildContext context,
AsyncSnapshot<SimpleResponce> snapshot) {
if (snapshot.data == null) {
return Center(child: Text("没有退出"));
} else {
return Center(child: Text("退出接口回掉成功!!"));
}
},
),
),
Container(
margin: EdgeInsets.fromLTRB(16, 10, 16, 20),
child: TextField(
cursorColor: Colors.black,
controller: _nameController,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10.0),
icon: Icon(Icons.text_fields, color: Colors.black),
labelText: 'name',
labelStyle: TextStyle(color: Colors.black)),
autofocus: false,
),
),
Container(
margin: EdgeInsets.fromLTRB(16, 0, 16, 20),
child: TextField(
cursorColor: Colors.black,
controller: _wordController,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(10.0),
icon: Icon(
Icons.text_fields,
color: Colors.black,
),
labelText: 'word',
labelStyle: TextStyle(color: Colors.black)),
autofocus: false,
),
),
Container(
width: double.maxFinite,
margin: EdgeInsets.fromLTRB(16, 0, 16, 0),
child: OutlineButton(
onPressed: () => _model.resignUser(
context, _nameController.text, _wordController.text),
child: Text("注册"),
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.circular(3),
),
)),
Container(
width: double.maxFinite,
margin: EdgeInsets.fromLTRB(16, 0, 16, 0),
child: OutlineButton(
onPressed: () => _model.logout(context),
child: Text("退出"),
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.circular(3),
),
)),
Expanded(
child: StreamBuilder<TestUserEntity>(
stream: _model.resignLive.stream,
initialData: _model.resignLive.data,
builder: (BuildContext context,
AsyncSnapshot<TestUserEntity> snapshot) {
if (snapshot.data != null) {
return Center(
child: snapshot.data.data == null
? Text("错误 ${snapshot.data.errorMsg}")
: Text("登入回掉 用户id: ${snapshot.data.data.id}"),
);
} else {
return Center(
child: Text("初始化~"),
);
}
},
),
)
],
),
);
} }
} }
...@@ -3,11 +3,46 @@ ...@@ -3,11 +3,46 @@
* @date 2019-09-04 * @date 2019-09-04
**/ **/
class UserPageModel { import 'package:flutter/cupertino.dart';
import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart';
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
import 'package:gmalpha_flutter/userModel/service/UserRepository.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
String text; import '../../../commonModel/live/LiveData.dart';
class UserPageModel extends BaseModel {
LiveData<SimpleResponce> logoutLive = new LiveData();
LiveData<TestUserEntity> resignLive = new LiveData();
// LiveData<String> userTokenLive = new LiveData();
UserPageModel() {}
void logout(BuildContext context) {
UserRepository.getInstance().logout().listen((data) {
logoutLive.notifyView(data);
}).onError((error) {
Toast.show(context, "error ${error}");
print(error);
});
}
void resignUser(BuildContext context, String name, String word) {
UserRepository.getInstance().resignUser(name, word, word).listen((data) {
print("data !! :${data}");
resignLive.notifyView(data);
}).onError((error) {
Toast.show(context, "error :${error}");
print(error);
});
}
@override
void dispose() {
logoutLive.dispost();
resignLive.dispost();
}
} }
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
* @author lsy * @author lsy
* @date 2019-09-04 * @date 2019-09-04
**/ **/
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/userModel/service/local/UserLocal.dart'; import 'package:gmalpha_flutter/userModel/service/local/UserLocal.dart';
import 'package:gmalpha_flutter/userModel/service/remote/UserRemote.dart'; import 'package:gmalpha_flutter/userModel/service/remote/UserRemote.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
import 'package:rxdart/rxdart.dart';
class UserRepository { class UserRepository {
UserRemote _remote; UserRemote _remote;
...@@ -23,5 +27,31 @@ class UserRepository { ...@@ -23,5 +27,31 @@ class UserRepository {
return _userRepository; return _userRepository;
} }
Observable<UserEntity> getUserInfo(String token) {
_remote.getUserInfo(token).map((value) {
if (value != null) {
_local.saveUserInfo(value);
}
return value;
});
}
Observable<TestUserEntity> resignUser(
String name, String word, String reword) {
return _remote.resignUser(name, word, reword).map((value) {
if (value != null) {
_local.saveUser(value);
}
return value;
});
}
Observable<SimpleResponce> logout() {
return _remote.logout().map((value) {
if (value != null) {
_local.logout();
}
return value;
});
}
} }
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
* @author lsy * @author lsy
* @date 2019-09-04 * @date 2019-09-04
**/ **/
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
class UserLocal { class UserLocal {
static UserLocal _userRemote; static UserLocal _userRemote;
...@@ -13,4 +16,16 @@ class UserLocal { ...@@ -13,4 +16,16 @@ class UserLocal {
} }
return _userRemote; return _userRemote;
} }
void saveUserInfo(UserEntity value) {
//TODO
}
void saveUser(TestUserEntity value) {
//TODO
}
void logout() {
//TODO
}
} }
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
* @author lsy * @author lsy
* @date 2019-09-04 * @date 2019-09-04
**/ **/
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/userModel/service/remote/api/UserLoginApi.serv.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
import 'package:rxdart/rxdart.dart';
class UserRemote { class UserRemote {
static UserRemote _userRemote; static UserRemote _userRemote;
...@@ -14,5 +20,16 @@ class UserRemote { ...@@ -14,5 +20,16 @@ class UserRemote {
return _userRemote; return _userRemote;
} }
Observable<UserEntity> getUserInfo(String token) {
return UserLoginApiImpl().getUserInfo(token);
}
Observable<TestUserEntity> resignUser(
String name, String word, String reWord) {
return UserLoginApiImpl().resign(name, word, reWord);
}
Observable<SimpleResponce> logout() {
return UserLoginApiImpl().logout();
}
} }
...@@ -6,13 +6,19 @@ import 'package:gmalpha_flutter/Annotations/anno/Get.dart'; ...@@ -6,13 +6,19 @@ import 'package:gmalpha_flutter/Annotations/anno/Get.dart';
import 'package:gmalpha_flutter/Annotations/anno/Post.dart'; import 'package:gmalpha_flutter/Annotations/anno/Post.dart';
import 'package:gmalpha_flutter/Annotations/anno/Query.dart'; import 'package:gmalpha_flutter/Annotations/anno/Query.dart';
import 'package:gmalpha_flutter/Annotations/anno/ServiceCenter.dart'; import 'package:gmalpha_flutter/Annotations/anno/ServiceCenter.dart';
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'; import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
@ServiceCenter() @ServiceCenter()
abstract class UserLoginApi { abstract class UserLoginApi {
@Post("user/login") @Post("user/register")
UserEntity login(@Query("name") String name, @Query("word") String word); TestUserEntity resign(@Query("username") String name,
@Query("password") String word, @Query("repassword") String repassword);
@Get("user/info") @Get("user/info")
UserEntity getUserInfo(@Query("token") String token); UserEntity getUserInfo(@Query("token") String token);
@Get("user/logout/json")
SimpleResponce logout();
} }
...@@ -10,18 +10,36 @@ import 'dart:io'; ...@@ -10,18 +10,36 @@ import 'dart:io';
import 'package:rxdart/rxdart.dart'; import 'package:rxdart/rxdart.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart';
import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'; import 'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart';
import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart'; import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
class UserLoginApiImpl { class UserLoginApiImpl {
Observable<UserEntity> login(String name, String word) { factory UserLoginApiImpl() => _sharedInstance();
return Observable.fromFuture(
DioUtil().post('user/login', data: {'name': name, 'word': word})) static UserLoginApiImpl _instance;
.map((value) {
UserLoginApiImpl._() {}
static UserLoginApiImpl _sharedInstance() {
if (_instance == null) {
_instance = UserLoginApiImpl._();
}
return _instance;
}
Observable<TestUserEntity> resign(
String name, String word, String repassword) {
return Observable.fromFuture(DioUtil().post('user/register', data: {
'username': name,
'password': word,
'repassword': repassword
})).map((value) {
if (value.statusCode == 200) { if (value.statusCode == 200) {
Map map = json.decode(value.toString()); Map map = json.decode(value.toString());
return UserEntity.fromJson(map); return TestUserEntity.fromJson(map);
} else { } else {
throw HttpException("statusCode error :${value.statusCode}"); throw HttpException("statusCode error :${value.statusCode}");
} }
...@@ -39,4 +57,16 @@ class UserLoginApiImpl { ...@@ -39,4 +57,16 @@ class UserLoginApiImpl {
} }
}); });
} }
Observable<SimpleResponce> logout() {
return Observable.fromFuture(DioUtil().get('user/logout/json'))
.map((value) {
if (value.statusCode == 200) {
Map map = json.decode(value.toString());
return SimpleResponce.fromJson(map);
} else {
throw HttpException("statusCode error :${value.statusCode}");
}
});
}
} }
/*
* @author lsy
* @date 2019-09-05
**/
class TestUserEntity {
Data data;
int errorCode;
String errorMsg;
TestUserEntity({this.data, this.errorCode, this.errorMsg});
TestUserEntity.fromJson(Map<String, dynamic> json) {
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
errorCode = json['errorCode'];
errorMsg = json['errorMsg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.data != null) {
data['data'] = this.data.toJson();
}
data['errorCode'] = this.errorCode;
data['errorMsg'] = this.errorMsg;
return data;
}
}
class Data {
bool admin;
List<String> chapterTops;
List<String> collectIds;
String email;
String icon;
int id;
String nickname;
String password;
String token;
int type;
String username;
Data(
{this.admin,
this.chapterTops,
this.collectIds,
this.email,
this.icon,
this.id,
this.nickname,
this.password,
this.token,
this.type,
this.username});
Data.fromJson(Map<String, dynamic> json) {
admin = json['admin'];
chapterTops = json['chapterTops'].cast<String>();
collectIds = json['collectIds'].cast<String>();
email = json['email'];
icon = json['icon'];
id = json['id'];
nickname = json['nickname'];
password = json['password'];
token = json['token'];
type = json['type'];
username = json['username'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['admin'] = this.admin;
data['chapterTops'] = this.chapterTops;
data['collectIds'] = this.collectIds;
data['email'] = this.email;
data['icon'] = this.icon;
data['id'] = this.id;
data['nickname'] = this.nickname;
data['password'] = this.password;
data['token'] = this.token;
data['type'] = this.type;
data['username'] = this.username;
return data;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment