dart_try 0.0.1 dart_try: ^0.0.1 copied to clipboard
The Try control gives us the ability write safe code without focusing on try-catch blocks in the presence of exceptions.
import 'package:dart_try/dart_try.dart';
void main() {
// execute http call that can fail
final test = Try.of(() => getSomething()).orElseGet('TEST');
}
Future<String> getSomething() {
return Future.value('');
}