You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
driver-app/lib/core/viewModels/authentication_view_model.dart

31 lines
840 B
Dart

import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/service/authentication_service.dart';
import 'package:driverapp/core/viewModels/base_view_model.dart';
import '../../locator.dart';
enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
class AuthenticationViewModel extends BaseViewModel {
AuthenticationService _authenticationService = locator<AuthenticationService>();
APP_STATUS get status {
if (state == ViewState.Busy || state == ViewState.BusyLocal) {
return APP_STATUS.LOADING;
} else {
if (user != null) {
return APP_STATUS.AUTHENTICATED;
} else {
return APP_STATUS.UNAUTHENTICATED;
}
}
}
login({String userName,String password}){
setState(ViewState.BusyLocal);
// call api
// if()
// setState(viewState)
}
}