immutable 0.0.4

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 62

immutable

Immutable collections for Dart. It's in its very early days and under heavy development, not ready for production use.

Usage

A simple usage example:

import 'package:immutable/immutable.dart';

main() {
  var stack = ImmutableStack.empty.push(5);
  print(stack.peek());
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.4

  • Add ImmutableMap and ImmutableMapBuilder class.
  • Remove clear method from ImmutableList. Use the empty constuctor instead.
  • Remove ImmutableListBuilder.empty constructor. Call toImmutable on an empty ImmutableList instead.
  • Turn on strong mode and fix warnings and errors.

0.0.3

  • Add ImmutableList and ImmutableListBuilder class.
  • Replace static empty fields with factory constructors.

0.0.2

  • Add ImmutableQueue class.

0.0.1

  • Add ImmutableStack class.

example/immutable.dart

// Copyright (c) 2015, <your name>. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

library immutable.example;

import 'package:immutable/immutable.dart';

main() {
  var m = new ImmutableMap<int, String>.empty();
  m = m.add(1, 'a').add(2, 'b').add(3, 'c');
  print('m[1]: ${m[1]}');
  print('m[2]: ${m[2]}');
  print('m[3]: ${m[3]}');
  print('m[4]: ${m[4]}');
  print('m.length: ${m.length}');
  print('m.keys: ${m.keys}');
  print('m.values: ${m.values}');

  print('--- forEach ---');
  m.forEach((int key, String value) {
    print('key $key, value $value');
  });
  print('---------------');

  final b = m.toBuilder();
  b[5] = 'foo';
  b[6] = 'bar';
  print('b.remove(1): ${b.remove(1)}');
  print(b);

  m = b.toImmutable();
  print('m[1]: ${m[1]}');
  print('m[2]: ${m[2]}');
  print('m[3]: ${m[3]}');
  print('m[5]: ${m[5]}');
  print('m[6]: ${m[6]}');

  m = m.remove(1).remove(2);
  print('m[1]: ${m[1]}');
  print('m[2]: ${m[2]}');
  print('m[3]: ${m[3]}');
  print('m.length: ${m.length}');
  print('m.keys: ${m.keys}');
  print('m.values: ${m.values}');
}

1. Depend on it

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


dependencies:
  immutable: "^0.0.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:immutable/immutable.dart';
        
Version Uploaded Documentation Archive
0.0.4 Nov 5, 2016 Go to the documentation of immutable 0.0.4 Download immutable 0.0.4 archive
0.0.3 Oct 22, 2015 Go to the documentation of immutable 0.0.3 Download immutable 0.0.3 archive
0.0.2 Sep 30, 2015 Go to the documentation of immutable 0.0.2 Download immutable 0.0.2 archive
0.0.1 Sep 29, 2015 Go to the documentation of immutable 0.0.1 Download immutable 0.0.1 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
38 / 100
Health:
Code health derived from static analysis. [more]
95 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75 / 100
Overall score:
Weighted score of the above. [more]
62

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
quiver_check >=1.0.0-dev.1 <1.1.0 1.0.0
Dev dependencies
quiver_iterables >=1.0.0-dev.1 <1.1.0
test >=0.12.0 <0.13.0