Skip to content

xenoken/no_try

Repository files navigation

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.

About

The foundation of a truly exception-free and error-free approach to programming.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages