import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart'; class AuthenticationViewModel extends ChangeNotifier { AuthenticationRepo authenticationRepo; AuthenticationViewModel({required this.authenticationRepo}); Future signUp({ required String phone, required String password, Function(dynamic)? onSuccess, Function(String)? onError, }) async { Utils.showLoading(); final String deviceIMEI = "cIkkB7h7Q7uoFkC4Qv82xG:APA91bEb53Z9XzqymCIctaLxCoMX6bm9fuKlWILQ59uUqfwhCoD42AOP1-jWGB1WYd9BVN5PT2pUUFxrT07vcNg1KH9OH39mrPgCl0m21XVIgWrzNnCkufg"; final resultEither = await authenticationRepo.selectDeviceByImei(deviceIMEI: deviceIMEI); if (resultEither.isLeft()) { } if (resultEither.isRight()) { } resultEither.fold( (failure) { Utils.hideLoading(); notifyListeners(); if (onError != null) onError(failure.message); }, (data) { notifyListeners(); if (onSuccess != null) onSuccess(data); }, ); } }