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.
- Host: GitHub
- URL: https://github.com/xenoken/no_try
- Owner: xenoken
- License: bsd-3-clause
- Created: 2019-07-03T17:50:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-03T18:12:25.000Z (almost 7 years ago)
- Last Synced: 2025-01-02T18:17:23.828Z (over 1 year ago)
- Topics: dart, dartlang, exception-handling, try-catch
- Language: Dart
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
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