refresh method

dynamic refresh(
  1. dynamic function(
    1. ValueNotifier<T> listener
    ), {
  2. dynamic error(
    1. Object err
    )?,
})

Implementation

refresh(Function(ValueNotifier<T> listener) function, {Function(Object err)? error}) async {
  try {
    await function(listener);
    listener.notifyListeners();
  } catch (_) {
    if (error != null) {
      error(_);
    }
  }
}