yak_error_handler 0.1.1+1 copy "yak_error_handler: ^0.1.1+1" to clipboard
yak_error_handler: ^0.1.1+1 copied to clipboard

discontinued
outdated

a simple dart package based on `riverpod` to easily handle `catch`

example/README.md

Example #

import 'dart:math' as math;
import 'package:riverpod/riverpod.dart';
import 'package:yak_error_handler/yak_error_handler.dart';
import 'package:yak_runner/yak_runner.dart';

final _random = math.Random();

void veryBadAPI() => _random.nextBool() ? {} : throw 'ops';

void main() {
  final container = ProviderContainer();

  // !! `IMPORTANT`  set the catchError before everything else!
  container.read(setCatchError)(
      (e, s) => print('****** ERRROR COUGHT *******\n$e\n$s'));

  final _runner = YakRunner(veryBadAPI, container.read(catchError));

  for (var i = 0; i < 10; ++i) {
    print('$i');
    _runner().when(
      success: (_) {},
      failure: (_, __) {},
    );
  }
}

Jump to Source

2
likes
0
points
13
downloads

Publisher

verified publisheryakforward.com

Weekly Downloads

a simple dart package based on `riverpod` to easily handle `catch`

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

riverpod

More

Packages that depend on yak_error_handler