Null Safety

update_flutter_3.16.0_voipcall
Aamir Muhammad 2 years ago
parent 0db3617737
commit 941134da49

@ -519,8 +519,8 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
onAddMedicationStart() async {
setState(ViewState.Busy);
Future onAddMedicationStart({required bool allowSetState}) async {
if (allowSetState) setState(ViewState.Busy);
List services = [];
if (medicationStrengthList.length == 0) {
if (services.isEmpty) {
@ -562,9 +562,8 @@ class SOAPViewModel extends BaseViewModel {
if (_SOAPService.hasError || _prescriptionService.hasError) {
error = _SOAPService.error! + _prescriptionService.error!;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
if (allowSetState) setState(ViewState.ErrorLocal);
} else if (allowSetState) setState(ViewState.Idle);
}
callAddAssessmentLookupsServices({String searchKey = "", bool allowSetState = true}) async {

@ -53,8 +53,10 @@ class _AddMedicationState extends State<AddMedication> {
ProjectViewModel projectViewModel = Provider.of(context);
return FractionallySizedBox(
child: BaseView<SOAPViewModel>(
onModelReady: (model) {
if (!mounted) model.onAddMedicationStart();
onModelReady: (model) async {
model.onAddMedicationStart(allowSetState: false).whenComplete(() {
setState(() {});
});
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,

Loading…
Cancel
Save