Skip to content

Commit 83baf8c

Browse files
authored
Merge pull request #27 from Hasilt/dart_3_support
Dart 3 support
2 parents 3f780e2 + 1c01d43 commit 83baf8c

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

.github/workflows/pull_request.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v3
1818
- uses: dart-lang/[email protected]
1919
with:
20-
sdk: 2.12.0
20+
sdk: stable
2121
- id: install
2222
name: Install dependencies
2323
run: dart pub get

.github/workflows/push.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- uses: dart-lang/[email protected]
1515
with:
16-
sdk: 2.12.0
16+
sdk: stable
1717
- id: install
1818
name: Install dependencies
1919
run: dart pub get

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## 0.5.0
4+
- Dart 3 support added.
5+
36
## 0.4.1
47
- Update the CI
58

example/pubspec.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: fuzzy_example
2-
version: 0.0.1
2+
version: 0.0.2
33

4-
authors:
5-
- Igor Borges <[email protected]>
64

75
environment:
8-
sdk: '>=2.0.0 <3.0.0'
6+
sdk: '>=3.0.3 <4.0.0'
97

108
publish_to: none
119

lib/bitap/bitap.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:latinize/latinize.dart';
1+
import 'package:stringr/stringr.dart';
22
import '../data/fuzzy_options.dart';
33
import 'bitap_pattern_alphabet.dart' as pa;
44
import 'bitap_search.dart';
@@ -20,7 +20,7 @@ class Bitap {
2020
Bitap(String pattern, {required FuzzyOptions options}) : options = options {
2121
this.pattern = options.isCaseSensitive ? pattern : pattern.toLowerCase();
2222
this.pattern =
23-
options.shouldNormalize ? latinize(this.pattern) : this.pattern;
23+
options.shouldNormalize ? this.pattern.latinize() : this.pattern;
2424
if (pattern.length <= options.maxPatternLength) {
2525
patternAlphabet = pa.patternAlphabet(this.pattern);
2626
}
@@ -41,7 +41,7 @@ class Bitap {
4141
text = text.toLowerCase();
4242
}
4343
if (options.shouldNormalize) {
44-
text = latinize(text);
44+
text = text.latinize();
4545
}
4646

4747
// Exact match

lib/fuzzy.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class Fuzzy<T> {
156156
var numTextMatches = 0;
157157

158158
final mainSearchResult = fullSearcher.search(value.toString());
159-
_log('Full text: "${value}", score: ${mainSearchResult.score}');
159+
_log('Full text: "$value", score: ${mainSearchResult.score}');
160160

161161
if (options.tokenize) {
162162
final words = value.toString().split(options.tokenSeparator);
@@ -181,7 +181,7 @@ class Fuzzy<T> {
181181
scores.add(1);
182182
}
183183
}
184-
_log('Token: "${word}", score: ${tokenSearchResult.score}');
184+
_log('Token: "$word", score: ${tokenSearchResult.score}');
185185
}
186186

187187
if (hasMatchInText) {
@@ -206,7 +206,7 @@ class Fuzzy<T> {
206206
? numTextMatches >= tokenSearchers.length
207207
: true;
208208

209-
_log('\nCheck Matches: ${checkTextMatches}');
209+
_log('\nCheck Matches: $checkTextMatches');
210210

211211
// If a match is found, add the item to <rawResults>, including its score
212212
if ((exists || mainSearchResult.isMatch) && checkTextMatches) {

pubspec.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
name: fuzzy
2-
version: 0.4.1
2+
version: 0.5.0
33

44
description: >
55
Fuzzy search in Dart. Initially a code conversion, subset of Fuse.js.
66
homepage: https://github.com/comigor/fuzzy
77

88
environment:
9-
sdk: ">=2.12.0-0.dev <3.0.0"
9+
sdk: '>=3.0.3 <4.0.0'
1010

1111
dependencies:
12-
latinize: ^0.1.0-nullsafety
12+
stringr: ^1.0.0
1313

1414
dev_dependencies:
15-
test: ^1.16.0-nullsafety
16-
pedantic: ^1.10.0-nullsafety
15+
test: ^1.24.6-nullsafety
16+
pedantic: ^1.11.1-nullsafety

0 commit comments

Comments
 (0)