Skip to content

The AsyncResult package provides a framework for managing asynchronous operations, defining AsyncResult<S, F> as a Future resolving to a Result<S, F>. This result can either be a Failure<F> containing a failure value or a Success<S> containing a success value, ensuring type-safe handling of asynchronous outcomes.

Notifications You must be signed in to change notification settings

p4-k4/dart-package-result

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This package provides a simple framework for managing synchronous and asynchronous operations in dart.

Results can either be a Failure containing a failure value or a Success containing a success value, ensuring type-safe handling of asynchronous outcomes.

Usage

import 'package:result/result.dart';

void main() async {
  final r = result();
  print(r);
  final aR = await asyncResult();
  print(aR);
}

Result<int, String> result() {
  try {
    return Success(1);
  } catch (e) {
    return Failure('Failed');
  }
}

AsyncResult<int, String> asyncResult() async {
  try {
    return Success(1);
  } catch (e) {
    return Failure('Failed');
  }
}

Author: Paurini Taketakehikuroa Wiringi

About

The AsyncResult package provides a framework for managing asynchronous operations, defining AsyncResult<S, F> as a Future resolving to a Result<S, F>. This result can either be a Failure<F> containing a failure value or a Success<S> containing a success value, ensuring type-safe handling of asynchronous outcomes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages