An open API service indexing awesome lists of open source software.

https://github.com/xenoken/no_try

The foundation of a truly exception-free and error-free approach to programming.
https://github.com/xenoken/no_try

dart dartlang exception-handling try-catch

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

          

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:

```dart
import 'package:no_try/no_try.dart';

Result 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][tracker].

[tracker]: http://github.com/xenoken/no_try/issues