tapper 0.1.2
tapper: ^0.1.2 copied to clipboard
Provides extension methods on all types to allow temporary, inspection/mutation (tapping) and transformation (piping)
example/main.dart
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
String nonNumericString = "abc";
Result<int, ConvException> result = nonNumericString.tryConv<int>();
// conversion is not possible and handled with Result
}