ruqe 1.0.0 copy "ruqe: ^1.0.0" to clipboard
ruqe: ^1.0.0 copied to clipboard

outdated

Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc.

ruqe #

Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc. Additionally, the library provides an excellent concept for modeling errors without resorting to exceptions.

Getting started #

In your Dart/Flutter project, add the dependency to your pubspec.yaml

dependencies:
  ruqe: ^1.0.0

import with

import 'package:ruqe/ruqe.dart';

Basic usage #

We can use Result as shown below:


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");
  }
}
6
likes
0
pub points
18%
popularity

Publisher

unverified uploader

Ruqe brings the convenient types and methods found in Rust into Dart, such as the Result, Option, pattern-matching, etc.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

equatable

More

Packages that depend on ruqe