David PHAM-VAN

Update dependencies

@@ -127,6 +127,9 @@ class MyAppState extends State<MyApp> with SingleTickerProviderStateMixin { @@ -127,6 +127,9 @@ class MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
127 final bytes = await build(pageFormat); 127 final bytes = await build(pageFormat);
128 128
129 final appDocDir = await getApplicationDocumentsDirectory(); 129 final appDocDir = await getApplicationDocumentsDirectory();
  130 + if (appDocDir == null) {
  131 + return;
  132 + }
130 final appDocPath = appDocDir.path; 133 final appDocPath = appDocDir.path;
131 final file = File(appDocPath + '/' + 'document.pdf'); 134 final file = File(appDocPath + '/' + 'document.pdf');
132 print('Save as file ${file.path} ...'); 135 print('Save as file ${file.path} ...');
@@ -12,7 +12,7 @@ dependencies: @@ -12,7 +12,7 @@ dependencies:
12 sdk: flutter 12 sdk: flutter
13 intl: ^0.17.0-nullsafety 13 intl: ^0.17.0-nullsafety
14 open_file: 14 open_file:
15 - path_provider: 15 + path_provider: ^2.0.0-nullsafety
16 printing: 16 printing:
17 url_launcher: ^6.0.0-nullsafety 17 url_launcher: ^6.0.0-nullsafety
18 18
@@ -33,9 +33,10 @@ ffi.DynamicLibrary _open() { @@ -33,9 +33,10 @@ ffi.DynamicLibrary _open() {
33 33
34 /// Set the Pdf document data 34 /// Set the Pdf document data
35 void setDocumentFfi(PrintJob job, Uint8List data) { 35 void setDocumentFfi(PrintJob job, Uint8List data) {
36 - final nativeBytes = ffi.allocate<ffi.Uint8>(count: data.length); 36 + final nativeBytes = ffi.calloc<ffi.Uint8>(data.length);
37 nativeBytes.asTypedList(data.length).setAll(0, data); 37 nativeBytes.asTypedList(data.length).setAll(0, data);
38 _setDocument(job.index, nativeBytes, data.length); 38 _setDocument(job.index, nativeBytes, data.length);
  39 + ffi.calloc.free(nativeBytes);
39 } 40 }
40 41
41 final _SetDocument_Dart _setDocument = 42 final _SetDocument_Dart _setDocument =
@@ -57,7 +58,7 @@ typedef _SetDocument_Dart = void Function( @@ -57,7 +58,7 @@ typedef _SetDocument_Dart = void Function(
57 58
58 /// Set the Pdf Error message 59 /// Set the Pdf Error message
59 void setErrorFfi(PrintJob job, String message) { 60 void setErrorFfi(PrintJob job, String message) {
60 - _setError(job.index, ffi.Utf8.toUtf8(message)); 61 + _setError(job.index, ffi.StringUtf8Pointer(message).toNativeUtf8());
61 } 62 }
62 63
63 final _SetError_Dart _setError = 64 final _SetError_Dart _setError =
@@ -11,7 +11,7 @@ environment: @@ -11,7 +11,7 @@ environment:
11 flutter: ">=1.16.0" 11 flutter: ">=1.16.0"
12 12
13 dependencies: 13 dependencies:
14 - ffi: ">=0.2.0-nullsafety <2.0.0" 14 + ffi: ">=0.3.1-nullsafety.0 <2.0.0"
15 flutter: 15 flutter:
16 sdk: flutter 16 sdk: flutter
17 flutter_web_plugins: 17 flutter_web_plugins: