intersperse 1.1.1-dev.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 81

intersperse #

Travis CI Codecov Pub.dev License Github Stars Twitter Follow GitHub Follow

Insert an element between each element of an Iterable or List.

final list1 = intersperse(2, <int>[]); // [];
final list2 = intersperse(2, [0]); // [0];
final list3 = intersperse(2, [0, 0]); // [0, 2, 0];
final list1Outer = intersperseOuter(2, <int>[]); // [];
final list2Outer = intersperseOuter(2, [0]); // [2, 0, 2];
final list3Outer = intersperseOuter(2, [0, 0]); // [2, 0, 2, 0, 2];

final Iterable<int> extension = [1, 2].intersperse(-1);
final Iterable<int> extensionOuter = [1, 2].intersperseOuter(-1);
  

1.1.1-dev.1 #

  • replaced folds with synchronous generators

1.1.0-dev.1+1 #

  • Extension on Iterable added

1.0.0 #

  • Initial version, created by Stagehand

example/intersperse_example.dart

import 'package:intersperse/intersperse.dart';

void main() {
  final list1 = intersperse(2, <int>[]); // [];
  final list2 = intersperse(2, [0]); // [0];
  final list3 = intersperse(2, [0, 0]); // [0, 2, 0];
  final list1Outer = intersperseOuter(2, <int>[]); // [];
  final list2Outer = intersperseOuter(2, [0]); // [2, 0, 2];
  final list3Outer = intersperseOuter(2, [0, 0]); // [2, 0, 2, 0, 2];

  final Iterable<int> extension = [1, 2].intersperse(-1);
  final Iterable<int> extensionOuter = [1, 2].intersperseOuter(-1);

  print(list1);
  print(list2);
  print(list3);
  print(list1Outer);
  print(list2Outer);
  print(list3Outer);
  print(extension);
  print(extensionOuter);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  intersperse: ^1.1.1-dev.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:intersperse/intersperse.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
63
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
95
Overall:
Weighted score of the above. [more]
81
Learn more about scoring.

We analyzed this package on Apr 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.7

Maintenance suggestions

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0-dev.4 <3.0.0
Dev dependencies
extra_pedantic ^1.1.1+2
test ^1.5.0
test_coverage ^0.2.0