immutables 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 47

Imutable data structures #

List, Map #

Examples #

var c = IList<int>([1, 2, 3]);

print((c + 4).value); // [1, 2, 3, 4]
print(c.value); // [1, 2, 3]

print((c - 3).value); // [1, 2]
print(c.value); // [1, 2, 3]

print(c.take(2).value); // [1, 2]
print(c.value); // [1, 2]

print(c.filter((_) => 1 == _ || 2 == _).value); // [1, 2]
print(c.value); // [1, 2, 3]

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

example/immutables_example.dart

import 'package:immutables/immutables.dart';

main() {
  var c = IList<int>([1, 2, 3]);

  print((c + 4).value); // [1, 2, 3, 4]
  print(c.value); // [1, 2, 3]

  print((c - 3).value); // [1, 2]
  print(c.value); // [1, 2, 3]

  print(c.take(2).value); // [1, 2]
  print(c.value); // [1, 2]

  print(c.filter((_) => 1 == _ || 2 == _).value); // [1, 2]
  print(c.value); // [1, 2, 3]
}

Use this package as a library

1. Depend on it

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


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

We analyzed this package on Nov 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:immutables/immutables.dart.

Health suggestions

Fix lib/src/list.dart. (-11.33 points)

Analysis of lib/src/list.dart reported 24 hints, including:

line 20 col 7: DO use curly braces for all flow control structures.

line 22 col 7: DO use curly braces for all flow control structures.

line 27 col 16: Avoid types as parameter names.

line 29 col 22: Avoid types as parameter names.

line 29 col 25: Avoid types as parameter names.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
json_matcher ^0.2.2
test ^1.0.0