Skip to content

Commit 4addab6

Browse files
Merge pull request #26 from 4-alok/dev
Migrated to null-safety
2 parents 78d2ef2 + 1d2be2f commit 4addab6

File tree

14 files changed

+149
-155
lines changed

14 files changed

+149
-155
lines changed

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ SPEC CHECKSUMS:
7070
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
7171
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
7272
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
73-
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
73+
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
7474
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
7575
pdf_text: 850e21d1a62672674099a07818c95a3f55030c81
7676
SDWebImage: 9169792e9eec3e45bba2a0c02f74bf8bd922d1ee
7777
SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40
7878

7979
PODFILE CHECKSUM: 3c448a1d0ade57273cab760b57b1a710ba8d268a
8080

81-
COCOAPODS: 1.9.3
81+
COCOAPODS: 1.10.0

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@
265265
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
266266
"${BUILT_PRODUCTS_DIR}/DKImagePickerController/DKImagePickerController.framework",
267267
"${BUILT_PRODUCTS_DIR}/DKPhotoGallery/DKPhotoGallery.framework",
268-
"${PODS_ROOT}/../Flutter/Flutter.framework",
269268
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
270269
"${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework",
271270
"${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework",
@@ -276,7 +275,6 @@
276275
outputPaths = (
277276
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKImagePickerController.framework",
278277
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DKPhotoGallery.framework",
279-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
280278
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
281279
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework",
282280
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework",

example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/main.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import 'dart:io';
21
import 'dart:math';
3-
42
import 'package:file_picker/file_picker.dart';
53
import 'package:flutter/material.dart';
64
import 'dart:async';
@@ -15,8 +13,8 @@ class MyApp extends StatefulWidget {
1513
}
1614

1715
class _MyAppState extends State<MyApp> {
18-
PDFDoc _pdfDoc;
19-
String _text = "";
16+
PDFDoc? _pdfDoc;
17+
String? _text = "";
2018

2119
bool _buttonsEnabled = true;
2220

@@ -68,7 +66,7 @@ class _MyAppState extends State<MyApp> {
6866
child: Text(
6967
_pdfDoc == null
7068
? "Pick a new PDF document and wait for it to load..."
71-
: "PDF document loaded, ${_pdfDoc.length} pages\n",
69+
: "PDF document loaded, ${_pdfDoc!.length} pages\n",
7270
style: TextStyle(fontSize: 18),
7371
textAlign: TextAlign.center,
7472
),
@@ -82,7 +80,7 @@ class _MyAppState extends State<MyApp> {
8280
),
8381
padding: EdgeInsets.all(15),
8482
),
85-
Text(_text),
83+
Text(_text!),
8684
],
8785
),
8886
)),
@@ -91,9 +89,11 @@ class _MyAppState extends State<MyApp> {
9189

9290
/// Picks a new PDF document from the device
9391
Future _pickPDFText() async {
94-
File file = await FilePicker.getFile();
95-
_pdfDoc = await PDFDoc.fromFile(file);
96-
setState(() {});
92+
var filePickerResult = await FilePicker.platform.pickFiles();
93+
if (filePickerResult != null) {
94+
_pdfDoc = await PDFDoc.fromPath(filePickerResult.files.single.path!);
95+
setState(() {});
96+
}
9797
}
9898

9999
/// Reads a random page of the document
@@ -105,8 +105,8 @@ class _MyAppState extends State<MyApp> {
105105
_buttonsEnabled = false;
106106
});
107107

108-
String text =
109-
await _pdfDoc.pageAt(Random().nextInt(_pdfDoc.length) + 1).text;
108+
String? text =
109+
await _pdfDoc!.pageAt(Random().nextInt(_pdfDoc!.length) + 1).text;
110110

111111
setState(() {
112112
_text = text;
@@ -123,7 +123,7 @@ class _MyAppState extends State<MyApp> {
123123
_buttonsEnabled = false;
124124
});
125125

126-
String text = await _pdfDoc.text;
126+
String text = await _pdfDoc!.text;
127127

128128
setState(() {
129129
_text = text;

example/pubspec.lock

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@ packages:
77
name: archive
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.0.13"
11-
args:
12-
dependency: transitive
13-
description:
14-
name: args
15-
url: "https://pub.dartlang.org"
16-
source: hosted
17-
version: "1.6.0"
10+
version: "3.1.2"
1811
async:
1912
dependency: transitive
2013
description:
@@ -28,7 +21,7 @@ packages:
2821
name: barcode
2922
url: "https://pub.dartlang.org"
3023
source: hosted
31-
version: "1.17.1"
24+
version: "2.1.0"
3225
boolean_selector:
3326
dependency: transitive
3427
description:
@@ -64,20 +57,13 @@ packages:
6457
url: "https://pub.dartlang.org"
6558
source: hosted
6659
version: "1.15.0"
67-
convert:
68-
dependency: transitive
69-
description:
70-
name: convert
71-
url: "https://pub.dartlang.org"
72-
source: hosted
73-
version: "2.1.1"
7460
crypto:
7561
dependency: transitive
7662
description:
7763
name: crypto
7864
url: "https://pub.dartlang.org"
7965
source: hosted
80-
version: "2.1.5"
66+
version: "3.0.0"
8167
cupertino_icons:
8268
dependency: "direct main"
8369
description:
@@ -112,14 +98,7 @@ packages:
11298
name: file_picker
11399
url: "https://pub.dartlang.org"
114100
source: hosted
115-
version: "1.13.3"
116-
file_picker_platform_interface:
117-
dependency: transitive
118-
description:
119-
name: file_picker_platform_interface
120-
url: "https://pub.dartlang.org"
121-
source: hosted
122-
version: "1.3.1"
101+
version: "3.0.0"
123102
flutter:
124103
dependency: "direct main"
125104
description: flutter
@@ -131,12 +110,17 @@ packages:
131110
name: flutter_plugin_android_lifecycle
132111
url: "https://pub.dartlang.org"
133112
source: hosted
134-
version: "1.0.11"
113+
version: "2.0.0"
135114
flutter_test:
136115
dependency: "direct dev"
137116
description: flutter
138117
source: sdk
139118
version: "0.0.0"
119+
flutter_web_plugins:
120+
dependency: transitive
121+
description: flutter
122+
source: sdk
123+
version: "0.0.0"
140124
http:
141125
dependency: transitive
142126
description:
@@ -157,7 +141,14 @@ packages:
157141
name: image
158142
url: "https://pub.dartlang.org"
159143
source: hosted
160-
version: "2.1.19"
144+
version: "3.0.1"
145+
js:
146+
dependency: transitive
147+
description:
148+
name: js
149+
url: "https://pub.dartlang.org"
150+
source: hosted
151+
version: "0.6.3"
161152
matcher:
162153
dependency: transitive
163154
description:
@@ -178,7 +169,7 @@ packages:
178169
name: optional
179170
url: "https://pub.dartlang.org"
180171
source: hosted
181-
version: "5.0.0+1"
172+
version: "6.0.0-nullsafety.0"
182173
path:
183174
dependency: transitive
184175
description:
@@ -192,7 +183,7 @@ packages:
192183
name: path_parsing
193184
url: "https://pub.dartlang.org"
194185
source: hosted
195-
version: "0.1.4"
186+
version: "0.2.0-nullsafety.0"
196187
path_provider:
197188
dependency: transitive
198189
description:
@@ -234,7 +225,7 @@ packages:
234225
name: pdf
235226
url: "https://pub.dartlang.org"
236227
source: hosted
237-
version: "1.13.0"
228+
version: "3.0.1"
238229
pdf_text:
239230
dependency: "direct dev"
240231
description:
@@ -255,7 +246,7 @@ packages:
255246
name: petitparser
256247
url: "https://pub.dartlang.org"
257248
source: hosted
258-
version: "3.1.0"
249+
version: "4.0.2"
259250
platform:
260251
dependency: transitive
261252
description:
@@ -269,7 +260,7 @@ packages:
269260
name: plugin_platform_interface
270261
url: "https://pub.dartlang.org"
271262
source: hosted
272-
version: "1.0.3"
263+
version: "2.0.0"
273264
process:
274265
dependency: transitive
275266
description:
@@ -283,7 +274,7 @@ packages:
283274
name: qr
284275
url: "https://pub.dartlang.org"
285276
source: hosted
286-
version: "1.3.0"
277+
version: "2.0.0"
287278
sky_engine:
288279
dependency: transitive
289280
description: flutter
@@ -344,7 +335,7 @@ packages:
344335
name: uuid
345336
url: "https://pub.dartlang.org"
346337
source: hosted
347-
version: "2.2.2"
338+
version: "3.0.1"
348339
vector_math:
349340
dependency: transitive
350341
description:
@@ -372,7 +363,7 @@ packages:
372363
name: xml
373364
url: "https://pub.dartlang.org"
374365
source: hosted
375-
version: "4.5.1"
366+
version: "5.0.2"
376367
sdks:
377-
dart: ">=2.12.0-259.9.beta <3.0.0"
368+
dart: ">=2.12.0 <3.0.0"
378369
flutter: ">=1.20.0"

example/pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ publish_to: 'none'
44
version: 1.0.0+1
55

66
environment:
7-
sdk: ">=2.3.0 <3.0.0"
7+
sdk: ">=2.12.0 <3.0.0"
88

99
dependencies:
1010
flutter:
@@ -14,15 +14,15 @@ dependencies:
1414
# Use with the CupertinoIcons class for iOS style icons.
1515
cupertino_icons: ^0.1.2
1616

17-
file_picker: ^1.5.0+2
17+
file_picker: ^3.0.0
1818

1919

2020
dev_dependencies:
2121
flutter_test:
2222
sdk: flutter
23-
pdf: ^1.12.0
24-
uuid: ^2.2.2
25-
optional: ^5.0.0+1
23+
pdf: ^3.0.1
24+
uuid: ^3.0.1
25+
optional: ^6.0.0-nullsafety.0
2626

2727
pdf_text:
2828
path: ../

0 commit comments

Comments
 (0)