sorted_list 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

Dart Sorted List #

A dart sorted list that keeps its elements ordered in the specified sequence.

Getting Started #

SortedList extends DelegatingList so you can use it directly as a replacement for List anywhere in your code where you need to keep items in the list sorted by a particular order.

SortedList sorts the items when they are inserted in the list so the inserts are slower, but the retrieval of items in a sorted order is faster.

SortedList doesn't support inserting items at a particular index. The items should always be inserted where they fall in the sorting order rather than at a particular index.

import 'package:sorted_list/sorted_list.dart';

main(List<String> args) {
  var sortedList = SortedList<int>((a, b) => a.compareTo(b));
  sortedList.add(1);
  sortedList.add(5);
  sortedList.add(3);
  sortedList.addAll([6, 9, 2]);

  for (var i in sortedList) {
    print(i);
  }
}

[0.1.0] - November 16th, 2019. #

  • Initial release.

example/main.dart

import 'package:sorted_list/sorted_list.dart';

main(List<String> args) {
  var sortedList = SortedList<int>((a, b) => a.compareTo(b));
  sortedList.add(1);
  sortedList.add(5);
  sortedList.add(3);
  sortedList.addAll([6, 9, 2]);

  for (var i in sortedList) {
    print(i);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  sorted_list: ^0.1.0

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:sorted_list/sorted_list.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
73
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
collection ^1.14.11 1.14.13 1.15.0-nullsafety