Skip to content

Commit

Permalink
Null-safety added
Browse files Browse the repository at this point in the history
  • Loading branch information
David Zimberknopf committed Aug 2, 2021
1 parent 6b28a21 commit 9fb39dc
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 69 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.packages
.dart_tool/package_config_subset
.dart_tool/version
.dart_tool/package_config.json
2 changes: 2 additions & 0 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android {
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}

buildTypes {
Expand All @@ -59,6 +60,7 @@ flutter {
}

dependencies {
implementation 'androidx.multidex:multidex:2.0.1' //with androidx libraries
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
}
19 changes: 10 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,19 @@ class _MyAppState extends State<MyApp> {
onPressed: () async {
// Export and then get File Reference
await exportAllLogs().then((value) async {

Directory externalDirectory;
Directory? externalDirectory;

if (Platform.isIOS) {
externalDirectory = await getApplicationDocumentsDirectory();
externalDirectory =
await getApplicationDocumentsDirectory();
} else {
externalDirectory = await getExternalStorageDirectory();
}

FlutterLogs.logInfo(TAG, "found", 'External Storage:$externalDirectory');
FlutterLogs.logInfo(
TAG, "found", 'External Storage:$externalDirectory');

File file = File("${externalDirectory.path}/$value");
File file = File("${externalDirectory!.path}/$value");

FlutterLogs.logInfo(
TAG, "path", 'Path: \n${file.path.toString()}');
Expand Down Expand Up @@ -193,7 +194,7 @@ class _MyAppState extends State<MyApp> {
initialDelaySecondsForPublishing: 10);
}

void logData({bool isException}) {
void logData({required bool isException}) {
if (!isException) {
FlutterLogs.logThis(
tag: TAG,
Expand All @@ -209,7 +210,7 @@ class _MyAppState extends State<MyApp> {
print("$i");
} else {
toggle = true;
var i = null;
dynamic i;
print(i * 10);
}
} catch (e) {
Expand All @@ -220,7 +221,7 @@ class _MyAppState extends State<MyApp> {
logMessage: 'Caught an exception!',
error: e,
level: LogLevel.ERROR);
} else {
} else if (e is Exception) {
FlutterLogs.logThis(
tag: TAG,
subTag: 'Caught an exception.',
Expand Down Expand Up @@ -249,7 +250,7 @@ class _MyAppState extends State<MyApp> {

Future<String> exportAllLogs() async {
FlutterLogs.exportLogs(exportType: ExportType.ALL);
return _completer.future;
return _completer.future as FutureOr<String>;
}

void exportFileLogs() {
Expand Down
71 changes: 32 additions & 39 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.6.1"
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"
cupertino_icons:
dependency: "direct main"
description:
Expand All @@ -56,21 +56,21 @@ packages:
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: "0.1.3"
version: "1.1.2"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
version: "6.1.2"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -88,90 +88,83 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
matcher:
dependency: transitive
description:
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.21"
version: "2.0.2"
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.2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+4"
version: "2.0.2"
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.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+1"
version: "2.0.3"
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: "1.0.3"
version: "2.0.1"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.13"
version: "4.2.3"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -183,70 +176,70 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.1"
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.3.0"
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: "1.7.3"
version: "2.2.5"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
version: "0.2.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.0.0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Demonstrates how to use the flutter_logs plugin.
# publish_to: 'none' # Remove this line if you wish to publish to pub.dev

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
flutter:
Expand All @@ -21,7 +21,7 @@ dependencies:
cupertino_icons: ^0.1.3

# Path Provider
path_provider: ^1.6.18
path_provider: ^2.0.2

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
Expand Down
Loading

0 comments on commit 9fb39dc

Please sign in to comment.