onDelete method

Future<void> onDelete(
  1. dynamic context,
  2. dynamic ref,
  3. String userId
)

Implementation

Future<void> onDelete(
  BuildContext context,
  WidgetRef ref,
  String userId,
) async {
  EasyLoading.show(status: L10n.of(context).unblockingUser);
  try {
    final account = ref.read(accountProvider);
    await account.unignoreUser(userId);
    if (!context.mounted) {
      EasyLoading.dismiss();
      return;
    }
    EasyLoading.showToast(L10n.of(context).userRemovedFromList);
  } catch (e, s) {
    _log.severe('Failed to unblock user', e, s);
    if (!context.mounted) {
      EasyLoading.dismiss();
      return;
    }
    EasyLoading.showError(
      L10n.of(context).unblockingUserFailed(e),
      duration: const Duration(seconds: 3),
    );
  }
}