Last updated:
0 purchases
result
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
}
}
copied to clipboard
LICENSE #
BSD LICENSE
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.