invariant_collection 1.0.9 copy "invariant_collection: ^1.0.9" to clipboard
invariant_collection: ^1.0.9 copied to clipboard

Invariant versions of standard collection types using extension types. As of version 1.0.9, the only kinds which are implemented are `Iterable`, `List`, and `Set`.

example/example.dart

// Copyright (c) 2024, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:invariant_collection/invariant_list.dart';

void main() {
  var xs = [1, 2, 3].iList;
  // IList<num> ys = xs; // Compile-time error.
  var zs = xs.sublist(1, 2); // OK, has type `IList<int>`.
  print(zs.last); // All `List` members are available.
}
2
likes
0
points
28
downloads

Publisher

unverified uploader

Weekly Downloads

Invariant versions of standard collection types using extension types. As of version 1.0.9, the only kinds which are implemented are `Iterable`, `List`, and `Set`.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on invariant_collection