pipe 1.0.2 copy "pipe: ^1.0.2" to clipboard
pipe: ^1.0.2 copied to clipboard

outdated

A starting point for Dart libraries or applications.

example/pipe_example.dart

import 'package:pipe/pipe.dart';

void main() {
  /// `String`:
  'Hello' | print; // Hello
  'Hello' | (s) => '$s, man!' | print; // Hello, man!

  /// `List`:
  [1, 2, 3] | print; // [1, 2, 3]

  /// `Map` and `Set` literals may produce syntax error:
  // {'a':123} | print; // syntax error
  // {1,2,3} | print; // syntax error
  // Use variables in this case:

  var m = {'a': 123};
  m | print; // {a: 123}

  var s = {1, 2, 3};
  s | print; // {1, 2, 3}

  // Only singe-argument functions are supported.
  // But you can go that way:

  /// Two-arrguments function:
  String concat(String a, String b) => a+b;
  
  'Hello' | (a) => concat(a, '!') | print; // Hello!

}
5
likes
0
pub points
22%
popularity

Publisher

unverified uploader

A starting point for Dart libraries or applications.

Homepage

License

unknown (LICENSE)

More

Packages that depend on pipe