Skip to content

Commit

Permalink
- Added better exception handling based on this comment: #643 (comment)
Browse files Browse the repository at this point in the history
…. Thanks BujusKrachus for the detailed explanation.
  • Loading branch information
jonbhanson committed Feb 18, 2024
1 parent becf36a commit b4f48de
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## [2.3.13] - (2024-Feb-18)

- Added better exception handling based on [this comment](https://github.com/jonbhanson/flutter_native_splash/issues/643#issuecomment-1938416308). Thanks [BujusKrachus](https://github.com/BujusKrachus) for the detailed explanation.

## [2.3.12] - (2024-Feb-18)

- Fix incorrect rejection of parameter values. Fixes [#652](https://github.com/jonbhanson/flutter_native_splash/issues/652).
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -19,7 +19,7 @@ First, add `flutter_native_splash` as a dependency in your pubspec.yaml file.

```yaml
dependencies:
flutter_native_splash: ^2.3.12
flutter_native_splash: ^2.3.13
```

Don't forget to `flutter pub get`.
Expand Down Expand Up @@ -177,15 +177,15 @@ flutter_native_splash:

## 2. Run the package

After adding your settings, run the following command in the terminal:
After adding your settings to `pubspec.yaml`, run the following command in the terminal:

```
dart run flutter_native_splash:create
```

When the package finishes running, your splash screen is ready.

To specify the YAML file location just add --path with the command in the terminal:
(Optionally), If you added your config to a separate YAML file instead of `pubspec.yaml`, just add --path with the command in the terminal:

```
dart run flutter_native_splash:create --path=path/to/my/file.yaml
Expand Down
7 changes: 6 additions & 1 deletion lib/cli_commands.dart
Expand Up @@ -347,7 +347,12 @@ Map<String, dynamic> getConfig({
filePath = 'pubspec.yaml';
}

final Map yamlMap = loadYaml(File(filePath).readAsStringSync()) as Map;
final Map yamlMap;
try {
yamlMap = loadYaml(File(filePath).readAsStringSync()) as Map;
} catch (e) {
throw Exception('Your `$filePath` appears to be empty or malformed.');
}

if (yamlMap['flutter_native_splash'] is! Map) {
throw Exception(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,7 +1,7 @@
name: flutter_native_splash
description: Customize Flutter's default white native splash screen with
background color and splash image. Supports dark mode, full screen, and more.
version: 2.3.12
version: 2.3.13
repository: https://github.com/jonbhanson/flutter_native_splash
issue_tracker: https://github.com/jonbhanson/flutter_native_splash/issues

Expand Down

0 comments on commit b4f48de

Please sign in to comment.