Skip to content
This repository has been archived by the owner on May 23, 2022. It is now read-only.

Commit

Permalink
[chore: ] Migrate to null-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
JideGuru committed May 8, 2021
1 parent 802a986 commit 4b331bf
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 85 deletions.
86 changes: 50 additions & 36 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ 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"
build:
dependency: transitive
description:
Expand Down Expand Up @@ -98,14 +98,14 @@ packages:
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"
checked_yaml:
dependency: transitive
description:
Expand All @@ -126,7 +126,7 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
code_builder:
dependency: transitive
description:
Expand All @@ -140,7 +140,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -189,21 +189,28 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.7"
version: "0.1.9"
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: "5.2.1"
version: "6.1.0"
fixnum:
dependency: transitive
description:
Expand Down Expand Up @@ -270,13 +277,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
io:
dependency: transitive
description:
Expand Down Expand Up @@ -311,14 +311,14 @@ 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"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -353,35 +353,42 @@ packages:
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.14"
version: "2.0.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
version: "2.0.0"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+3"
version: "2.0.0"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "2.0.0"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
pedantic:
dependency: transitive
description:
Expand Down Expand Up @@ -409,7 +416,7 @@ packages:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "3.0.0"
plugin_platform_interface:
dependency: transitive
description:
Expand All @@ -430,7 +437,7 @@ packages:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
version: "4.2.1"
pub_semver:
dependency: transitive
description:
Expand Down Expand Up @@ -484,21 +491,21 @@ 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"
stream_transform:
dependency: transitive
description:
Expand All @@ -512,21 +519,21 @@ packages:
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"
timing:
dependency: transitive
description:
Expand All @@ -540,14 +547,14 @@ packages:
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"
watcher:
dependency: transitive
description:
Expand All @@ -562,13 +569,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
win32:
dependency: transitive
description:
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
version: "0.2.0"
yaml:
dependency: transitive
description:
Expand All @@ -577,5 +591,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.20.0"
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
cupertino_icons: ^0.1.2
permission_handler: ^4.2.0+hotfix.1
dio: ^3.0.9
path_provider: ^1.4.0
path_provider: ^2.0.1

dev_dependencies:
flutter_test:
Expand Down
4 changes: 2 additions & 2 deletions lib/epub_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class EpubViewer {

/// bookPath should be a local file.
/// Last location is only available for android.
static void open(String bookPath, {EpubLocator lastLocation}) async {
static void open(String bookPath, {EpubLocator? lastLocation}) async {
Map<String, dynamic> agrs = {
"bookPath": bookPath,
'lastLocation':
Expand All @@ -53,7 +53,7 @@ class EpubViewer {

/// bookPath should be an asset file path.
/// Last location is only available for android.
static Future openAsset(String bookPath, {EpubLocator lastLocation}) async {
static Future openAsset(String bookPath, {EpubLocator? lastLocation}) async {
if (extension(bookPath) == '.epub') {
Map<String, dynamic> agrs = {
"bookPath": (await Util.getFileFromAsset(bookPath)).path,
Expand Down
12 changes: 6 additions & 6 deletions lib/model/epub_locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ part of 'package:epub_viewer/epub_viewer.dart';

/// Model for android EpubLocator
class EpubLocator {
String bookId;
String href;
int created;
Locations locations;
String? bookId;
String? href;
int? created;
Locations? locations;

EpubLocator({this.bookId, this.href, this.created, this.locations});

Expand All @@ -24,15 +24,15 @@ class EpubLocator {
data['href'] = this.href;
data['created'] = this.created;
if (this.locations != null) {
data['locations'] = this.locations.toJson();
data['locations'] = this.locations!.toJson();
}
return data;
}
}

/// Model for Locations in [EpubLocator]
class Locations {
String cfi;
String? cfi;

Locations({this.cfi});

Expand Down
Loading

0 comments on commit 4b331bf

Please sign in to comment.