result 1.0.4

Dart native js
Flutter Android iOS web

Object that represents either a success or a failure; 'success' or 'failure' for each case

Result #

Object that represents either a success or a failure

main() {
  var s= Result.success(2);
  print(s.get()); // 2

  var ss = s.map(
    (x) => x + 1
  );
  print(ss.get()); // 3
 
  var f = Result.failure(Exception("exception"));
  print(f);//Result, failure

  var ff = f.map(
    (f) => Exception("another exception")
  );
  print(ff);// Result, failure

  worker() {
    //work staff
    throw Exception("work exception");
  }
  try {
    var r = Result(worker());
    r = r.get();
  } catch (e) {
    print(e); // work exception
  }
}

LICENSE #

BSD LICENSE

1
likes
90
pub points
49%
popularity

Object that represents either a success or a failure; 'success' or 'failure' for each case

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

liulimg@gmail.com

License

BSD (LICENSE)

More

Packages that depend on result