Skip to content

Commit bd50a35

Browse files
author
Flutterclutter
committed
Update ffi to 1.0 and adapt calls accordingly
1 parent 5f30ede commit bd50a35

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

example/pubspec.lock

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.4.2"
10+
version: "2.5.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.0.0"
17+
version: "2.1.0"
1818
camera:
1919
dependency: "direct main"
2020
description:
@@ -28,28 +28,28 @@ packages:
2828
name: characters
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.0.0"
31+
version: "1.1.0"
3232
charcode:
3333
dependency: transitive
3434
description:
3535
name: charcode
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.1.3"
38+
version: "1.2.0"
3939
clock:
4040
dependency: transitive
4141
description:
4242
name: clock
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.0.1"
45+
version: "1.1.0"
4646
collection:
4747
dependency: transitive
4848
description:
4949
name: collection
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.14.13"
52+
version: "1.15.0"
5353
cupertino_icons:
5454
dependency: "direct main"
5555
description:
@@ -63,14 +63,14 @@ packages:
6363
name: fake_async
6464
url: "https://pub.dartlang.org"
6565
source: hosted
66-
version: "1.1.0"
66+
version: "1.2.0"
6767
ffi:
6868
dependency: transitive
6969
description:
7070
name: ffi
7171
url: "https://pub.dartlang.org"
7272
source: hosted
73-
version: "0.1.3"
73+
version: "1.0.0"
7474
file:
7575
dependency: transitive
7676
description:
@@ -136,21 +136,21 @@ packages:
136136
name: matcher
137137
url: "https://pub.dartlang.org"
138138
source: hosted
139-
version: "0.12.8"
139+
version: "0.12.10"
140140
meta:
141141
dependency: transitive
142142
description:
143143
name: meta
144144
url: "https://pub.dartlang.org"
145145
source: hosted
146-
version: "1.1.8"
146+
version: "1.3.0"
147147
path:
148148
dependency: transitive
149149
description:
150150
name: path
151151
url: "https://pub.dartlang.org"
152152
source: hosted
153-
version: "1.7.0"
153+
version: "1.8.0"
154154
path_provider:
155155
dependency: "direct main"
156156
description:
@@ -225,56 +225,56 @@ packages:
225225
name: source_span
226226
url: "https://pub.dartlang.org"
227227
source: hosted
228-
version: "1.7.0"
228+
version: "1.8.0"
229229
stack_trace:
230230
dependency: transitive
231231
description:
232232
name: stack_trace
233233
url: "https://pub.dartlang.org"
234234
source: hosted
235-
version: "1.9.5"
235+
version: "1.10.0"
236236
stream_channel:
237237
dependency: transitive
238238
description:
239239
name: stream_channel
240240
url: "https://pub.dartlang.org"
241241
source: hosted
242-
version: "2.0.0"
242+
version: "2.1.0"
243243
string_scanner:
244244
dependency: transitive
245245
description:
246246
name: string_scanner
247247
url: "https://pub.dartlang.org"
248248
source: hosted
249-
version: "1.0.5"
249+
version: "1.1.0"
250250
term_glyph:
251251
dependency: transitive
252252
description:
253253
name: term_glyph
254254
url: "https://pub.dartlang.org"
255255
source: hosted
256-
version: "1.1.0"
256+
version: "1.2.0"
257257
test_api:
258258
dependency: transitive
259259
description:
260260
name: test_api
261261
url: "https://pub.dartlang.org"
262262
source: hosted
263-
version: "0.2.17"
263+
version: "0.2.19"
264264
typed_data:
265265
dependency: transitive
266266
description:
267267
name: typed_data
268268
url: "https://pub.dartlang.org"
269269
source: hosted
270-
version: "1.2.0"
270+
version: "1.3.0"
271271
vector_math:
272272
dependency: transitive
273273
description:
274274
name: vector_math
275275
url: "https://pub.dartlang.org"
276276
source: hosted
277-
version: "2.0.8"
277+
version: "2.1.0"
278278
xdg_directories:
279279
dependency: transitive
280280
description:
@@ -283,5 +283,5 @@ packages:
283283
source: hosted
284284
version: "0.1.0"
285285
sdks:
286-
dart: ">=2.9.0-14.0.dev <3.0.0"
287-
flutter: ">=1.17.0 <2.0.0"
286+
dart: ">=2.12.0-259.9.beta <3.0.0"
287+
flutter: ">=1.17.0"

lib/edge_detection.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Coordinate extends Struct {
1414
double y;
1515

1616
factory Coordinate.allocate(double x, double y) =>
17-
allocate<Coordinate>().ref
17+
malloc<Coordinate>().ref
1818
..x = x
1919
..y = y;
2020
}
@@ -30,7 +30,7 @@ class NativeDetectionResult extends Struct {
3030
Pointer<Coordinate> topRight,
3131
Pointer<Coordinate> bottomLeft,
3232
Pointer<Coordinate> bottomRight) =>
33-
allocate<NativeDetectionResult>().ref
33+
malloc<NativeDetectionResult>().ref
3434
..topLeft = topLeft
3535
..topRight = topRight
3636
..bottomLeft = bottomLeft
@@ -89,7 +89,7 @@ class EdgeDetection {
8989
.lookup<NativeFunction<DetectEdgesFunction>>("detect_edges")
9090
.asFunction<DetectEdgesFunction>();
9191

92-
NativeDetectionResult detectionResult = detectEdges(Utf8.toUtf8(path)).ref;
92+
NativeDetectionResult detectionResult = detectEdges(path.toNativeUtf8()).ref;
9393

9494
return EdgeDetectionResult(
9595
topLeft: Offset(
@@ -116,7 +116,7 @@ class EdgeDetection {
116116

117117

118118
return processImage(
119-
Utf8.toUtf8(path),
119+
path.toNativeUtf8(),
120120
result.topLeft.dx,
121121
result.topLeft.dy,
122122
result.topRight.dx,

pubspec.lock

+21-21
Original file line numberDiff line numberDiff line change
@@ -7,56 +7,56 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.4.2"
10+
version: "2.5.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "2.0.0"
17+
version: "2.1.0"
1818
characters:
1919
dependency: transitive
2020
description:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.0.0"
24+
version: "1.1.0"
2525
charcode:
2626
dependency: transitive
2727
description:
2828
name: charcode
2929
url: "https://pub.dartlang.org"
3030
source: hosted
31-
version: "1.1.3"
31+
version: "1.2.0"
3232
clock:
3333
dependency: transitive
3434
description:
3535
name: clock
3636
url: "https://pub.dartlang.org"
3737
source: hosted
38-
version: "1.0.1"
38+
version: "1.1.0"
3939
collection:
4040
dependency: transitive
4141
description:
4242
name: collection
4343
url: "https://pub.dartlang.org"
4444
source: hosted
45-
version: "1.14.13"
45+
version: "1.15.0"
4646
fake_async:
4747
dependency: transitive
4848
description:
4949
name: fake_async
5050
url: "https://pub.dartlang.org"
5151
source: hosted
52-
version: "1.1.0"
52+
version: "1.2.0"
5353
ffi:
5454
dependency: "direct main"
5555
description:
5656
name: ffi
5757
url: "https://pub.dartlang.org"
5858
source: hosted
59-
version: "0.1.3"
59+
version: "1.0.0"
6060
flutter:
6161
dependency: "direct main"
6262
description: flutter
@@ -73,21 +73,21 @@ packages:
7373
name: matcher
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.12.8"
76+
version: "0.12.10"
7777
meta:
7878
dependency: transitive
7979
description:
8080
name: meta
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "1.1.8"
83+
version: "1.3.0"
8484
path:
8585
dependency: transitive
8686
description:
8787
name: path
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.7.0"
90+
version: "1.8.0"
9191
sky_engine:
9292
dependency: transitive
9393
description: flutter
@@ -99,56 +99,56 @@ packages:
9999
name: source_span
100100
url: "https://pub.dartlang.org"
101101
source: hosted
102-
version: "1.7.0"
102+
version: "1.8.0"
103103
stack_trace:
104104
dependency: transitive
105105
description:
106106
name: stack_trace
107107
url: "https://pub.dartlang.org"
108108
source: hosted
109-
version: "1.9.5"
109+
version: "1.10.0"
110110
stream_channel:
111111
dependency: transitive
112112
description:
113113
name: stream_channel
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "2.0.0"
116+
version: "2.1.0"
117117
string_scanner:
118118
dependency: transitive
119119
description:
120120
name: string_scanner
121121
url: "https://pub.dartlang.org"
122122
source: hosted
123-
version: "1.0.5"
123+
version: "1.1.0"
124124
term_glyph:
125125
dependency: transitive
126126
description:
127127
name: term_glyph
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "1.1.0"
130+
version: "1.2.0"
131131
test_api:
132132
dependency: transitive
133133
description:
134134
name: test_api
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "0.2.17"
137+
version: "0.2.19"
138138
typed_data:
139139
dependency: transitive
140140
description:
141141
name: typed_data
142142
url: "https://pub.dartlang.org"
143143
source: hosted
144-
version: "1.2.0"
144+
version: "1.3.0"
145145
vector_math:
146146
dependency: transitive
147147
description:
148148
name: vector_math
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "2.0.8"
151+
version: "2.1.0"
152152
sdks:
153-
dart: ">=2.9.0-14.0.dev <3.0.0"
154-
flutter: ">=1.17.0 <2.0.0"
153+
dart: ">=2.12.0-259.9.beta <3.0.0"
154+
flutter: ">=1.17.0"

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ environment:
1111
dependencies:
1212
flutter:
1313
sdk: flutter
14-
ffi: ^0.1.3
14+
ffi: ^1.0.0
1515

1616
dev_dependencies:
1717
flutter_test:

0 commit comments

Comments
 (0)