list_accessors 0.0.2

  • Readme
  • Changelog
  • Installing
  • 16

Dart Lists have a first and a last getter and setter, so you can easily do stuff like this:

var theList = ['banana'];
theList.first = 'apple';
print(theList.last);

But why stop there? #

Wouldn't it be cool to also be able to call theList.second or theList.thirdLast?

Or even theList.eigth?

Wonder no more! By harnessing the power of extension methods, this package offers getters and setters for the first and last twenty items of a list!

[0.0.2] - 2019-10-21

  • Reduce accessors to the twenty first and last elements.
  • Use helper methods to make code more concise.

[0.0.1] - 2019-10-21

  • Add accessors for the million first and last elements.

Use this package as a library

1. Depend on it

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


dependencies:
  list_accessors: ^0.0.2

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

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

  • Dart: 2.7.0
  • pana: 0.13.4

Analysis issues and suggestions

Make sure dartfmt successfully runs on your package's source files.

Running dartfmt -n . failed with the following output:

Exception: dartfmt on lib/ failed with exit code 65
Could not format because the source could not be parsed:

line 3, column 24 of lib/list_accessors.dart: A extension declaration must have a body, even if it is empty.
  ╷
3 │ extension <T> on List<T> ListGetters {
  │                        ^
  ╵
line 3, column 26 of lib/list_accessors.dart: Functions must have an explicit list of parameters.
  ╷

Health issues and suggestions

Fix lib/list_accessors.dart. (-100 points)

Analysis of lib/list_accessors.dart failed with 424 errors, 152 hints, including:

line 3 col 24: A extension declaration must have a body, even if it is empty.

line 3 col 26: Functions must have an explicit list of parameters.

line 5 col 18: Undefined name 'length'.

line 7 col 65: Undefined name 'length'.

line 12 col 3: Undefined class 'T'.

Document public APIs. (-1 points)

2 out of 2 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and list_accessors.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0