test<T> method

Future<T?> test<T>(
  1. String name,
  2. Future<T> fn(), {
  3. bool skipWhenNull = false,
})

Implementation

Future<T?> test<T>(
  String name,
  Future<T> Function() fn, {
  bool skipWhenNull = false,
}) async {
  try {
    if (skipWhenNull) {
      _showSkip(name);
      return null;
    }

    var value = await fn();

    _showAction(name);

    return value;
  } catch (e) {
    _showError(name);

    loggy.error('$name\n');
    loggy.error(e);
  }

  return null;
}