Skip to content

Commit

Permalink
Migrated to null safety
Browse files Browse the repository at this point in the history
  • Loading branch information
Saad29 committed Mar 8, 2021
1 parent f62fc1b commit 5f945ea
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 64 deletions.
122 changes: 96 additions & 26 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,63 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -73,21 +87,21 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.1"
version: "2.0.3"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
version: "0.13.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
version: "4.0.0"
image_picker:
dependency: "direct main"
description:
Expand All @@ -101,42 +115,84 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "2.0.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
version: "1.11.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "3.0.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -148,56 +204,70 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.12.13 <2.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ environment:

dependencies:
image_picker: ^0.6.3+1
path_provider: ^1.6.0
http: ^0.12.0+4
path_provider: ^2.0.1
http: ^0.13.0

flutter:
sdk: flutter
Expand Down
16 changes: 8 additions & 8 deletions lib/gallery_saver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class GallerySaver {
static const MethodChannel _channel = const MethodChannel(channelName);

///saves video from provided temp path and optional album name in gallery
static Future<bool> saveVideo(String path, {String albumName}) async {
File tempFile;
if (path == null || path.isEmpty) {
static Future<bool?> saveVideo(String path, {String? albumName}) async {
File? tempFile;
if (path.isEmpty) {
throw ArgumentError(pleaseProvidePath);
}
if (!isVideo(path)) {
Expand All @@ -30,7 +30,7 @@ class GallerySaver {
tempFile = await _downloadFile(path);
path = tempFile.path;
}
bool result = await _channel.invokeMethod(
bool? result = await _channel.invokeMethod(
methodSaveVideo,
<String, dynamic>{'path': path, 'albumName': albumName},
);
Expand All @@ -41,9 +41,9 @@ class GallerySaver {
}

///saves image from provided temp path and optional album name in gallery
static Future<bool> saveImage(String path, {String albumName}) async {
File tempFile;
if (path == null || path.isEmpty) {
static Future<bool?> saveImage(String path, {String? albumName}) async {
File? tempFile;
if (path.isEmpty) {
throw ArgumentError(pleaseProvidePath);
}
if (!isImage(path)) {
Expand All @@ -54,7 +54,7 @@ class GallerySaver {
path = tempFile.path;
}

bool result = await _channel.invokeMethod(
bool? result = await _channel.invokeMethod(
methodSaveImage,
<String, dynamic>{'path': path, 'albumName': albumName},
);
Expand Down
Loading

0 comments on commit 5f945ea

Please sign in to comment.