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

Provides extension methods on all types to allow temporary, inspection/mutation (tap), transformation (pipe), and converting (conv)

example/main.dart

// ignore_for_file: unused_local_variable

import 'package:rust_core/result.dart';
import 'package:tapper/tapper.dart';

void main() {
  int? number = 10;
  number = number.tap((n) => ++n).tap((n) => print("The number is $n"));
  // Prints: The number is 10

  number.pipe((n) => ++n).pipe((n) {
    print("The number is $n");
    return n;
  });
  // Prints: The number is 11

  String numericString = "123";
  number = numericString.convInt(); // convInt exists for this type
  // number is now 123

  Object nonNumericString = "abc";
  Result<int, TryConvError> numberResult = nonNumericString.tryConv<int>();
  // conversion is not possible and handled with Result

  List<Set<List<int>>> nestedInt = [
    {
      [1]
    }
  ];
  Result<String, TryConvError> stringResult = nestedInt.tryConv<String>();
  // result is Ok("1")
}
4
likes
0
pub points
53%
popularity

Publisher

verified publishervoyver.com

Provides extension methods on all types to allow temporary, inspection/mutation (tap), transformation (pipe), and converting (conv)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

rust_core

More

Packages that depend on tapper