fix(sos-contacts): prevent deleting last emergency contact
This commit is contained in:
@@ -88,6 +88,12 @@ class SosContactsViewModel extends Notifier<SosContactsViewState> {
|
||||
}
|
||||
|
||||
Future<void> removeContact(int index) async {
|
||||
if (state.contacts.length <= 1) {
|
||||
state = state.copyWith(
|
||||
errorMessage: I18n.sosMinimumOneContact,
|
||||
);
|
||||
return;
|
||||
}
|
||||
state = state.copyWith(isSaving: true, errorMessage: '');
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user