no_try 1.0.0 copy "no_try: ^1.0.0" to clipboard
no_try: ^1.0.0 copied to clipboard

Foundation for a exception-free approach to programing in Dart.

Foundation for a exception-free approach to programing in Dart.

No more try-catch blocks and exception throwing. Only functions returning a value on success and a reason on failure.

Usage #

A simple usage example:

import 'package:no_try/no_try.dart';

Result<bool, String> execComputation(String arg) => arg.isNotEmpty
    ? Result.success(true)
    : Result.failed('Null argument was given.');


void main() {
  /// returns the actual value.
  var result = execComputation('Hello World!');
  print(result.success ? result.value : result.reason );

  /// returns the reason the computation failed.
  result = execComputation('');
  print( result.success ? result.value : result.reason);
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0
likes
25
pub points
0%
popularity

Publisher

unverified uploader

Foundation for a exception-free approach to programing in Dart.

Repository
View/report issues

License

unknown (LICENSE)

More

Packages that depend on no_try