ruqe 1.0.0 ruqe: ^1.0.0 copied to clipboard
Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc.
import 'package:ruqe/ruqe.dart';
void main() {
var trigger = triggerError();
var result = trigger.match<int?>(
ok: (value) => value,
err: (_) => 0,
);
print(result);
}
Result<int, String> triggerError() {
try {
var value = int.parse("%65");
return Ok(value);
} catch (err) {
return Err("Value is none");
}
}