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

Extension methods for Strings and iterables, inspired by Haskell

example/example.dart

import 'package:heart/heart_types.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<List<String>> deckOfCards = [cardValues, cardSuits].zip();
  print('Sorted deck: \n$deckOfCards\n');

  List shuffledDeck = deckOfCards.shuffled();
  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).toStrings().intercalate('-');
  print('$countdown HAPPY NEW YEAR!');
}
12
likes
160
points
235
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Extension methods for Strings and iterables, inspired by Haskell

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

collection

More

Packages that depend on heart