tapper 0.1.10 copy "tapper: ^0.1.10" to clipboard
tapper: ^0.1.10 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, ConvException> numberResult = nonNumericString.tryConv<int>();
  // conversion is not possible and handled with Result

  List<Set<List<int>>> nestedInt = [
    {
      [1]
    }
  ];
  Result<String, ConvException> stringResult = nestedInt.tryConv<String>();
  // result is Ok("1")
}
2
likes
150
pub points
22%
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

Documentation

API reference

License

MIT (LICENSE)

Dependencies

rust_core

More

Packages that depend on tapper