/* * @author lsy * @date 2019-09-04 **/ 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/questionModel/service/QuestionRepository.dart'; import 'package:gmalpha_flutter/QuestionModel/service/remote/entity/TestQuestionEntity.dart'; import 'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'; import '../../../commonModel/live/LiveData.dart'; class QuestionPageModel extends BaseModel { LiveData<SimpleResponce> logoutLive = new LiveData(); LiveData<TestQuestionEntity> resignLive = new LiveData(); // LiveData<String> userTokenLive = new LiveData(); QuestionPageModel() {} void logout(BuildContext context) { QuestionRepository.getInstance().logout().listen((data) { logoutLive.notifyView(data); }).onError((error) { Toast.show(context, "error ${error}"); print(error); }); } void resignUser(BuildContext context, String name, String word) { QuestionRepository.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(); } }