tie_fp 0.0.2 copy "tie_fp: ^0.0.2" to clipboard
tie_fp: ^0.0.2 copied to clipboard

Functional Opinionated library for Flutter

example/tie_fp_example.dart

import 'package:tie_fp/tie_fp.dart';

void main() async {
  Result<int> result = await performOperation();

  if (result.isError()) {
    print('An error occurred: ${result.getError()}');
  } else {
    int value = result.getValue()!;
    print('Operation successful! Result: $value');
  }
}

Future<Result<int>> performOperation() async {
  // Perform some operation that may succeed or fail
  try {
    var value = await Future.value(42);
    return Success(value);
  } catch (e) {
    return Failure(e);
  }
}

Result tryCatchExample<T>() {
  try {
    var result = performOperationThatMayThrowException();
    return Success(result);
  } catch (e) {
    return Failure(e);
  }
}

Object performOperationThatMayThrowException() => throw UnimplementedError();
0
likes
0
points
174
downloads

Publisher

verified publisherunacorbatanegra.dev

Weekly Downloads

Functional Opinionated library for Flutter

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on tie_fp