result_option 1.0.2 copy "result_option: ^1.0.2" to clipboard
result_option: ^1.0.2 copied to clipboard

discontinued
outdated

The types that represent the result of the operation. this is useful when designing API requires that an user should handle errors explicitly.

The types that represent the result of the operation. this is useful when designing API requires that an user should handle errors explicitly.

Installing #

dependencies:
  result_option:
import 'package:result_option/result_option.dart';

Usage #

  • Result

    final result = fetchCompanies(startsWithG: true);
      
    result.match(
      ok: (c) => print(c),
      err: (e) => print(e),
    );
    
    • Construct

      Result<int, String> value = ok(calculate('3+5/2'));
      Result<int, String> failed = err('Calculation failed');
      
  • Option

    Option<SomeObj> maybeObj = SomeObj.fromJson(json);
      
    SomeObj obj = maybeObj.unwrap() ?? defaultObj;
    SomeObj obj = maybeObj.unwrapOr(orElse: () => defaultObj);
    
    • Construct

      Option<int> value = some(1);
      Option<int> nothing = none();
      

Features and bugs #

here

0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

The types that represent the result of the operation. this is useful when designing API requires that an user should handle errors explicitly.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

to_string_pretty

More

Packages that depend on result_option