Skip to content

Commit 60b87b1

Browse files
kylelmhdrinckes
andauthored
migrated dart to v3 (#639)
Co-authored-by: Doug Rinckes <[email protected]>
1 parent d73ccd8 commit 60b87b1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

dart/lib/src/open_location_code.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,12 @@ bool isValid(String code) {
134134
if (padMatch.length != 1) {
135135
return false;
136136
}
137-
var matchLength = padMatch.first.group(0).length;
137+
var matches = padMatch.first.group(0);
138+
if (matches == null) {
139+
return false;
140+
}
141+
142+
var matchLength = matches.length;
138143
if (matchLength.isOdd || matchLength > separatorPosition - 2) {
139144
return false;
140145
}

dart/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ description: Open Location Codes are short, generated codes that can be used lik
33
version: 0.0.1
44
homepage: http://openlocationcode.com/
55
environment:
6-
sdk: '<3.0.0'
6+
sdk: '^2.19.6'
77
dev_dependencies:
8-
test: '>=0.12.0'
8+
test: ^1.24.3

dart/test/encode_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void checkEncodeDecode(String csvLine) {
2323
var elements = csvLine.split(',');
2424
num lat = double.parse(elements[0]);
2525
num lng = double.parse(elements[1]);
26-
num len = int.parse(elements[2]);
26+
int len = int.parse(elements[2]);
2727
var want = elements[3];
2828
var got = olc.encode(lat, lng, codeLength: len);
2929
expect(got, equals(want));

0 commit comments

Comments
 (0)