heart 0.5.8 copy "heart: ^0.5.8" to clipboard
heart: ^0.5.8 copied to clipboard

Extension methods for Strings and lists, inspired by Haskell

example/example.dart

import 'package:heart/heart.dart';

/// Small sample of package features
void main() {
  List<String> cardValues =
      ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] * 4;

  List<String> cardSuits =
      ['spades'] * 13 + ['hearts'] * 13 + ['diamonds'] * 13 + ['clubs'] * 13;

  List deckOfCards = zip([cardValues, cardSuits]);
  List shuffledDeck = deckOfCards.shuffled();

  print('Sorted deck: \n$deckOfCards\n');

  print('Shuffled deck: \n$shuffledDeck\n');

  List redCards = shuffledDeck
      .filter((card) => card.contains('hearts') || card.contains('diamonds'));

  print('Red cards:\n$redCards\n');
  // ----------

  String countdown = inclusive(10, 1).toStringList().intercalate('-');
  print('$countdown HAPPY NEW YEAR!');
}
12
likes
150
points
16
downloads

Publisher

unverified uploader

Weekly Downloads

Extension methods for Strings and lists, inspired by Haskell

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection

More

Packages that depend on heart