Skip to content

Commit

Permalink
migrated dart to v3 (#639)
Browse files Browse the repository at this point in the history
Co-authored-by: Doug Rinckes <drinckes@google.com>
  • Loading branch information
kylelmh and drinckes authored Dec 6, 2024
1 parent d73ccd8 commit 60b87b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion dart/lib/src/open_location_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ bool isValid(String code) {
if (padMatch.length != 1) {
return false;
}
var matchLength = padMatch.first.group(0).length;
var matches = padMatch.first.group(0);
if (matches == null) {
return false;
}

var matchLength = matches.length;
if (matchLength.isOdd || matchLength > separatorPosition - 2) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ description: Open Location Codes are short, generated codes that can be used lik
version: 0.0.1
homepage: http://openlocationcode.com/
environment:
sdk: '<3.0.0'
sdk: '^2.19.6'
dev_dependencies:
test: '>=0.12.0'
test: ^1.24.3
2 changes: 1 addition & 1 deletion dart/test/encode_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void checkEncodeDecode(String csvLine) {
var elements = csvLine.split(',');
num lat = double.parse(elements[0]);
num lng = double.parse(elements[1]);
num len = int.parse(elements[2]);
int len = int.parse(elements[2]);
var want = elements[3];
var got = olc.encode(lat, lng, codeLength: len);
expect(got, equals(want));
Expand Down

0 comments on commit 60b87b1

Please sign in to comment.