sokerr 1.1.0 copy "sokerr: ^1.1.0" to clipboard
sokerr: ^1.1.0 copied to clipboard

Simple Result Sum Type

example/sokerr_example.dart

import 'package:sokerr/sokerr.dart';

///
//ignore_for_file: avoid_print

Future<void> main() async {
  final res = await getSomethingFromDb().result();

  return switch(res) {
    Ok(:final ok) => print("Data: $ok"),
    Err(:final err, :final st) => print("ERROR: $err, $st"),
  };
}

Future<String> getSomethingFromDb() async {
  throw Exception("Db not found");
}
0
likes
140
points
55
downloads

Publisher

verified publishernamzug.dev

Weekly Downloads

Simple Result Sum Type

Repository (GitHub)
View/report issues

Topics

#result #pattern-matching #types

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

meta

More

Packages that depend on sokerr