Files
fcs/lib/pages/main/model/base_model.dart

42 lines
823 B
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/domain/entities/setting.dart';
import 'package:fcs/domain/entities/user.dart';
2020-09-04 15:30:10 +06:30
import 'package:flutter/foundation.dart';
2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/api_helper.dart';
2020-09-04 15:30:10 +06:30
import 'main_model.dart';
abstract class BaseModel extends ChangeNotifier {
User user;
Setting setting;
MainModel mainModel;
void initUser(User user) async {
this.user = user;
}
2020-09-22 03:52:48 +06:30
void privilegeChanged() {}
2020-09-04 15:30:10 +06:30
void initSetting(Setting setting) async {
this.setting = setting;
}
2020-11-13 02:38:16 +06:30
void notify() {
notifyListeners();
}
2020-09-22 03:52:48 +06:30
void logout() {}
2020-09-04 15:30:10 +06:30
// request makes http request
// if token is null
dynamic request(
String path,
method, {
dynamic payload,
String token,
String url,
}) async {
return await requestAPI(path, method,
payload: payload, token: token, url: url);
}
}