import 'package:flutter/src/widgets/framework.dart'; import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart'; import 'package:gmalpha_flutter/commonModel/live/LiveData.dart'; import 'package:gmalpha_flutter/questionModel/service/QuestionRepository.dart'; import 'package:gmalpha_flutter/questionModel/service/remote/entity/QuestionEntity.dart'; ///* // * @author lsy // * @date 2019-09-04 // **/ // //import 'package:flutter/material.dart'; //import 'package:gmalpha_flutter/commonModel/live/BaseModel.dart'; //import 'package:gmalpha_flutter/commonModel/live/LiveData.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/QuestionEntity.dart'; // class QuestionPageModel extends BaseModel { LiveData<QuestionEntity> live = LiveData(); final String id; QuestionPageModel(this.id); @override void dispose() { live.dispost(); } void init(BuildContext context) { QuestionRepository.getInstance().getQuestion(id).listen((value) { live.notifyView(value); }).onError((error) { print(error); }); } } // //class QuestionPageModel extends BaseModel { // LiveData<QuestionEntity> questionLive = new LiveData(); // // final String id; // QuestionPageModel(this.id); // // init(BuildContext context) { // QuestionRepository.getInstance() // .getQuestion(id) // .listen((value) { // if (value != null) { // questionLive.notifyView(value); // } // }).onError((error) { // Toast.show(context, "${error.toString()}"); // print(error); // }); // } // // // @override // void dispose() { // questionLive.dispost(); // } //}