Skip to content

Commit

Permalink
Merge pull request #17 from MadBrains/dev
Browse files Browse the repository at this point in the history
2.2.2
  • Loading branch information
KolasikOmetov authored Nov 2, 2023
2 parents 242e6aa + 1b9a5a4 commit 959d290
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.2.2

* Fix FlutterError.onError setup

## 2.2.0+1

* Fix doc
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FVM_DART = $(FVM) dart


init:
$(FVM) use 3.3.4 --force; $(FVM_DART) pub global activate pana;
$(FVM) use 3.10.6 --force; $(FVM_DART) pub global activate pana;

version:
$(FVM_FLUTTER) --version; $(FVM_DART) --version;
Expand Down
3 changes: 1 addition & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ linter:
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- collection_methods_unrelated_type
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
Expand All @@ -55,12 +56,10 @@ linter:
- file_names
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- list_remove_unrelated_type
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_duplicate_case_values
Expand Down
22 changes: 12 additions & 10 deletions lib/src/_app_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ mixin _AppRunner on WidgetsBinding {

static void _attach(RunnerConfiguration config) {
final WidgetsBinding binding =
config.widgetConfig.initializeBinding?.call() ?? WidgetsFlutterBinding.ensureInitialized();
config.widgetConfig.initializeBinding?.call() ??
WidgetsFlutterBinding.ensureInitialized();

binding
..scheduleAttachRootWidget(
Expand All @@ -44,7 +45,9 @@ mixin _AppRunner on WidgetsBinding {
final bool? oldCallbackResult = oldCallback?.call(exception, stackTrace);
final bool newCallbackResult = onPlatformError(exception, stackTrace);

return (oldCallbackResult == null) ? newCallbackResult : (oldCallbackResult && newCallbackResult);
return (oldCallbackResult == null)
? newCallbackResult
: (oldCallbackResult && newCallbackResult);
};
}
}
Expand All @@ -62,22 +65,21 @@ class _App extends StatelessWidget {
return ReloadableWidget(
builder: (BuildContext context) {
_flutterErrorSetup();
ErrorWidget.builder = (FlutterErrorDetails errorDetails) => ErrorHandlerWidget(
errorDetails: errorDetails,
releaseErrorBuilder: widgetConfig.releaseErrorBuilder,
errorBuilder: widgetConfig.errorBuilder,
);
ErrorWidget.builder =
(FlutterErrorDetails errorDetails) => ErrorHandlerWidget(
errorDetails: errorDetails,
releaseErrorBuilder: widgetConfig.releaseErrorBuilder,
errorBuilder: widgetConfig.errorBuilder,
);

return widgetConfig.child;
},
);
}

void _flutterErrorSetup() {
final FlutterExceptionHandler? oldCallback = FlutterError.onError;

FlutterError.onError = (FlutterErrorDetails errorDetails) {
oldCallback?.call(errorDetails);
FlutterError.presentError(errorDetails);
widgetConfig.onFlutterError(errorDetails);
};
}
Expand Down
6 changes: 4 additions & 2 deletions lib/src/app_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class AppBuilder<T extends Object?> extends StatefulWidget {
}

class _AppBuilderState<T extends Object?> extends State<AppBuilder<T>> {
late final FutureOr<T>? preInitialize = widget.preInitialize?.call(WidgetsBinding.instance);
late final FutureOr<T>? preInitialize =
widget.preInitialize?.call(WidgetsBinding.instance);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -80,7 +81,8 @@ class _AppBuilderState<T extends Object?> extends State<AppBuilder<T>> {
builder: (BuildContext context, AsyncSnapshot<T> snapshot) {
final Object? error = snapshot.error;
if (error != null) {
final StackTrace stackTrace = snapshot.stackTrace ?? StackTrace.current;
final StackTrace stackTrace =
snapshot.stackTrace ?? StackTrace.current;
Zone.current.handleUncaughtError(error, stackTrace);
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: app_runner
description: Launch your Flutter app like a pro! AppRunner is a configurator for quick and controlled launch of your application.
version: 2.2.0+1
version: 2.2.2
repository: https://github.com/MadBrains/App-Runner-Flutter
issue_tracker: https://github.com/MadBrains/App-Runner-Flutter/issues
homepage: https://madbrains.ru/
Expand Down

0 comments on commit 959d290

Please sign in to comment.