heart 0.2.2 copy "heart: ^0.2.2" to clipboard
heart: ^0.2.2 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');

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

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

  String countdown = nums(10, 1).toStringList().intercalate('-');
  print('\n$countdown HAPPY NEW YEAR!');
}
10
likes
150
pub points
3%
popularity

Publisher

unverified uploader

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