Skip to content

Releases: passsy/kt.dart

v1.1.0

20 Mar 13:12
Compare
Choose a tag to compare
  • #190 KtMutableMapEntry.setValue() is now implemented (thx @hugobrancowb)
  • #188 Added KtIterable.firstNotNullOf() KtIterable.firstNotNullOfOrNull() (thx @hugobrancowb)
  • #196 Methods, returning mutated copies are now marked with @useReslt (thx @nohli)
  • #197 mapNotNull, mapNotNullTo, mapIndexedNotNull, mapIndexedNotNullTo, filterNotNullTo work now correctly for non-nullable types

v1.0.0

27 Sep 09:37
Compare
Choose a tag to compare
  • #183 New: KtIterable.sumOf thx @nohli
  • Update dependencies and guarantee compatibility with Dart 2.12-2.18

Full Changelog: v0.10.0...v1.0.0

0.10.0

31 Oct 16:49
Compare
Choose a tag to compare

Some nullsafety improvements, type fixes and a lot of new Kotlin 1.4 extensions

  • #141 Fix: requireNoNulls() now converts T? to T

  • 1df6e1a Fix: .dart and .iter on Iterable<T> now work for all types not only if T implements Comparable

  • f43cbc5 Fix: *NotNull methods now return non-nullable types

  • b727893 Fix: The hashcode of all collections doesn't get cached anymore. That caused problems when mutable items in a KtList changed. The equals and hashCode methods now always change together.

  • #141 Improve: KtIterable.onEach can now be chained

  • #141 New: KtIterable.cast() to manually cast values

  • #141 New: KtIterable.onEachIndexed

  • #163 New: KtIterable.shuffled()

  • #166 New: KtIterable.reduceOrNull()

  • #169 New: KtMutableList.removeFirst() KtMutableList.removeLast()

  • #173 New: KtMutableList.removeFirstOrNull() KtMutableList.removeLastOrNull()

  • #171 New: KtIterable.minOf()

  • #165 New: String.replaceFirstChar()

  • #170 New: KtIterable.minOrNull(), KtIterable.maxOrNull(), deprecates KtIterable.min(), KtIterable.max(),

  • #174 New: KtIterable.runningReduce()

  • #177 New: KtCollection.randomOrNull()

  • #178 New: KtIterable.flatMapIndexed, KtIterable.flatMapIndexedTo

Thanks to the #hacktoberfest contributors @Anas35, @robiness, @MatthaiosSait, @Dev-dfm, @marciokuroki, @Rishabh-Negi

v0.9.1

22 May 15:38
Compare
Choose a tag to compare
  • #138 Deprecate KtIterable<T>.sumByDouble in favor of KtIterable<T>.sumBy which now works for int and double
  • #140 KtMap.getOrDefault now returns V instead of V?
  • #140 Fix KtMap.groupBy returning KtMap<K, KtMutableList<T>> instead of KtMap<K, KtList<T>> causing generic type problems in further processing

v0.9.0

14 Mar 16:25
Compare
Choose a tag to compare
  • stable dependencies
  • Improve KtSet.contains performance

0.9.0-nullsafety.0

14 Mar 16:25
07abc12
Compare
Choose a tag to compare
  • Migrate to Dart 2.12 with [null-safety(https://dart.dev/null-safety) support

v0.8.0

01 Oct 10:36
18ff094
Compare
Choose a tag to compare

New package:kt_dart/standard.dart library containing Kotlins loved standard extensions

  • #120 Standard extensions let, also, takeIf and takeUnless
  • #120 TODO([String message]) top-level function which throws NotImplementedException
  • #120 repeat(int times, void Function(int) action) top-level function

More cool updates

  • #124 KtList.of and KtSet.of now allow null as parameters. Same for listOf and setOf
  • #131 Chain Comparators with the new thenBy and thenByDescending functions.
  • #126 Allow const .empty() constructors for KtList, KtMap and KtSet (Thanks @TimWhiting)
  • #127 plus, minus operator overrides for KtSet, returning KtSet and not KtList as the KtIterable operators do

v0.8.0-dev.1

27 Apr 08:36
Compare
Choose a tag to compare
  • #124 KtList.of and KtSet.of now allow null as parameters. Same for listOf and setOf
  • #120 Standard extensions let, also, takeIf and takeUnless
  • #120 TODO([String message]) top-level function which throws NotImplementedException
  • #120 repeat(int times, void Function(int) action) top-level function
  • #126 Allow const .empty() constructors for KtList, KtMap and KtSet (Thanks @TimWhiting)
  • #127 plus, minus operator overrides for KtSet, returning KtSet and not KtList as the KtIterable operators do

v0.7.0

01 Mar 18:20
Compare
Choose a tag to compare

The library has be upgrade to use Static Extension Methods.

Interop

This update also includes extensions for Dart collections which allow easy interoperability between dart and kt.dart collections using the .kt and .dart getters.

  // New: Converting dart collections to KtDart collections (mutable views)
  final KtMutableList<String> ktList = ["hey"].kt;
  final KtMutableSet<String> ktSet = {"hey"}.kt;
  final KtMutableMap<String, int> ktMap = {"hey": 1}.kt;

  // Converting KtDart collections to dart collections
  final List<String> dartList = KtList.of("hey").dart;
  final Set<String> dartSet = KtSet.of("hey").dart;
  final Map<String, int> dartMap = KtMap.from({"hey": 1}).dart;

Note: ["Hello", "World"].kt returns a KtMutableList<String> and mutations are reflected on the original dart list. It is not a copy! Because it doesn't copy it is very cheap and only syntax sugar.

To convert dart collections to their immutable kt.dart counterparts use: .toImmutableList(), .toImmutableSet(), .toImmutableMap()

  // New: Make dart collections immutable
  final KtList<String> list = ["hey"].toImmutableList();
  final KtSet<String> set = {"hey"}.toImmutableSet();
  final KtMap<String, int> map = {"hey": 1}.toImmutableMap();

Possible breaking changes

  • Relax sortBy/sortByDescending, maxBy/minBy typing to work better with ints and doubles #116
// Was: int doesn't not implement Comparable<int> but Comparable<num>
// minBy therefore required some help to figure out the correct type (<num>) 
users.minBy<num>((it) => it.age);

// Now: minBy doesn't require the Comparable (num) to have the same same as the value (int).
users.minBy((it) => it.age);
  • Remove unnecessary generic R from KtIterable.zipWithNext #118

New Extensions

  • KtPair and KtTriple now have a new toList() function to convert the values to a KtList
  • KtList?.orEmpty() returns an empty list when the list is null
  • KtSet?.orEmpty() returns an empty set when the set is null
  • KtMap?.orEmpty() returns an empty map when the map is null
  • KtMap.ifEmpty(() -> defaultValue) returns the default value when the map is empty
  • KtIterable<KtIterable<T>>.flatten() flattens the nested collections to KtIterable<T>
  • KtIterable<KtPair<T, U>>.unzip(): KtPair<KtList<T>, KtList<U>> unzips list of pairs to list of their first and second values
  • KtIterable<Comparable<T>>.min() returns the smallest element of any comparable iterable
  • KtIterable<Comparable<T>>.max() returns the largest element of any comparable iterable

v0.7.0-dev.4

29 Dec 19:21
Compare
Choose a tag to compare
v0.7.0-dev.4 Pre-release
Pre-release
  • New extension Iterable.toImmutableList(): KtList
  • New extension Iterable.toImmutableSet(): KtSet
  • New extension KtIterable<num>.average(): double
  • Relax sortBy/sortByDescending, maxBy/minBy typing to work better with ints and doubles
// Was: int doesn't not implement Comparable<int> but Comparable<num>
// minBy therefore required some help to figure out the correct type (<num>) 
users.minBy<num>((it) => it.age);

// Now: minBy doesn't require the Comparable (num) to have the same same as the value (int).
users.minBy((it) => it.age);