Skip to content

Commit 090fc71

Browse files
committed
Update to Dart 3
1 parent 06a2a5c commit 090fc71

7 files changed

+22
-21
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 4.0.3
2+
- Update to Dart 3
3+
14
## 4.0.2
25
- Add purge() method to reset the data store
36

analysis_options.yaml

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
# Defines a default set of lint rules enforced for
2-
# projects at Google. For details and rationale,
3-
# see https://github.com/dart-lang/pedantic#enabled-lints.
4-
include: package:pedantic/analysis_options.yaml
1+
include: package:lints/recommended.yaml
52

6-
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7-
# Uncomment to specify additional rules.
8-
# linter:
9-
# rules:
10-
# - camel_case_types
11-
12-
analyzer:
13-
# exclude:
14-
# - path/to/excluded/files/**
3+
linter:
4+
rules:
5+
prefer_single_quotes: true
6+
unawaited_futures: true

lib/src/crdt.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ abstract class Crdt<K, V> {
2020

2121
/// Returns a simple key-value map without HLCs or deleted records.
2222
/// See [recordMap].
23-
Map<K, V> get map =>
23+
Map<K, V?> get map =>
2424
(recordMap()..removeWhere((_, record) => record.isDeleted))
25-
.map((key, record) => MapEntry(key, record.value!));
25+
.map((key, record) => MapEntry(key, record.value));
2626

2727
List<K> get keys => map.keys.toList();
2828

29-
List<V> get values => map.values.toList();
29+
List<V?> get values => map.values.toList();
3030

3131
Crdt() {
3232
refreshCanonicalTime();

lib/src/hlc.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class Hlc<T> implements Comparable<Hlc> {
107107
'-$nodeId';
108108

109109
@override
110-
int get hashCode => toString().hashCode;
110+
int get hashCode => Object.hash(millis, counter, nodeId).hashCode;
111111

112112
@override
113113
bool operator ==(other) => other is Hlc<T> && compareTo(other) == 0;

lib/src/record.dart

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class Record<V> {
3434
bool operator ==(other) =>
3535
other is Record<V> && hlc == other.hlc && value == other.value;
3636

37+
@override
38+
int get hashCode => Object.hash(hlc, value, modified);
39+
3740
@override
3841
String toString() => toJson('').toString();
3942
}

pubspec.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: crdt
22
description: Dart implementation of Conflict-free Replicated Data Types (CRDTs).
3-
version: 4.0.2
3+
version: 4.0.3
44
homepage: https://github.com/cachapa/crdt
55
repository: https://github.com/cachapa/crdt
66
issue_tracker: https://github.com/cachapa/crdt/issues
77

88
environment:
9-
sdk: '>=2.12.0 <3.0.0'
9+
sdk: '>=3.0.0 <4.0.0'
1010

1111
dependencies:
1212
# no dependencies, no problems
1313

1414
dev_dependencies:
15-
pedantic: ^1.11.0
16-
test: ^1.17.4
15+
lints: any
16+
test: any

test/map_crdt_test.dart

+3
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ class TestClass {
290290
@override
291291
bool operator ==(other) => other is TestClass && test == other.test;
292292

293+
@override
294+
int get hashCode => test.hashCode;
295+
293296
@override
294297
String toString() => test;
295298
}

0 commit comments

Comments
 (0)