From e90e35bd8c740ccbc385b72969a56e678b0362e4 Mon Sep 17 00:00:00 2001 From: basemosama Date: Thu, 16 Apr 2026 04:02:59 +0200 Subject: [PATCH 1/4] update playx_navigation packge --- CHANGELOG.md | 4 ++-- example/lib/main.dart | 7 ++++++- example/pubspec.lock | 6 +++--- pubspec.yaml | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98be49d..18f55ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,9 @@ # Changelog -## 2.1.0 +## 2.1.0 - 2.1.1 ### Dependency Updates -* `playx_navigation: ^2.0.0` +* `playx_navigation: ^2.1.0` ### Navigation Enhancements (`playx_navigation` 2.0.0) * **Updated `PlayxNavigationSettings.goRouter`** to accept the new `PlayxPageConfig? config` parameter, enabling global defaults for: diff --git a/example/lib/main.dart b/example/lib/main.dart index cc1351c..d926737 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -26,7 +26,12 @@ void main() async { final goRouter = GoRouter( routes: [ PlayxRoute( - path: '/', builder: (context, state, isInitialized) => const Home()), + path: '/', + builder: ( + context, + state, + ) => + const Home()), ], ); diff --git a/example/pubspec.lock b/example/pubspec.lock index f1e4375..d9700e2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -691,7 +691,7 @@ packages: path: ".." relative: true source: path - version: "2.1.0" + version: "2.1.1" playx_core: dependency: transitive description: @@ -712,10 +712,10 @@ packages: dependency: transitive description: name: playx_navigation - sha256: "31f774a4da59e7264d2647094b35f0640b78f65cfd68fa3f82f19e28bbe22776" + sha256: "199939b6928cd739209543dad86f0c7e7489bc63b3a2b94a98593a9d98afd339" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" playx_network: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c9350c7..3d0f3ae 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: playx description: Playx eco system helps with redundant features as it provides many utilities for themes, widgets and more. -version: 2.1.0 +version: 2.1.1 homepage: https://sourcya.io repository: https://github.com/playx-flutter/playx issue_tracker: https://github.com/playx-flutter/playx/issues @@ -23,7 +23,7 @@ dependencies: playx_theme: ^2.0.0 playx_widget: ^0.5.0 playx_network: ^1.0.0 - playx_navigation: ^2.0.0 + playx_navigation: ^2.1.0 playx_localization: ^0.4.0 queen_validators: ^1.0.1 sentry_flutter: ^9.17.0 From 5b7376c36fa8e282820b34ef5c1e084e11ce12a6 Mon Sep 17 00:00:00 2001 From: basemosama Date: Thu, 21 May 2026 13:42:10 +0300 Subject: [PATCH 2/4] fix: initialize Playx boot within Sentry's appRunner zone - Move the `boot` call inside the `SentryFlutter.init` `appRunner` callback when Sentry is enabled - Ensure binding initialization and `runApp` execute in the same zone to improve compatibility, especially on Flutter web - Maintain standard boot sequence when Sentry is not configured --- lib/src/playx.dart | 51 ++++++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/lib/src/playx.dart b/lib/src/playx.dart index facd7f5..b4c9291 100644 --- a/lib/src/playx.dart +++ b/lib/src/playx.dart @@ -201,29 +201,44 @@ abstract class Playx { 'Use either envSettingsBuilder or envSettings, not both.', ); - // Boots Playx dependencies. - await boot( - appConfig: appConfig, - themeConfig: themeConfig, - envSettings: envSettings, - localeConfig: localeConfig, - appConfigBuilder: appConfigBuilder, - localeConfigBuilder: localeConfigBuilder, - themeConfigBuilder: themeConfigBuilder, - envSettingsBuilder: envSettingsBuilder, - securePrefsSettings: securePrefsSettings, - prefsSettings: prefsSettings, - workManagerSettings: workManagerSettings, - webSettings: webSettings, - ); - if (sentryOptions != null) { await SentryFlutter.init( sentryOptions, - // Run the app after initializing Sentry. - appRunner: () => runApp(app), + // Boot Playx inside Sentry's app runner so binding initialization and + // runApp execute in the same zone, especially on Flutter web. + appRunner: () async { + await boot( + appConfig: appConfig, + themeConfig: themeConfig, + envSettings: envSettings, + localeConfig: localeConfig, + appConfigBuilder: appConfigBuilder, + localeConfigBuilder: localeConfigBuilder, + themeConfigBuilder: themeConfigBuilder, + envSettingsBuilder: envSettingsBuilder, + securePrefsSettings: securePrefsSettings, + prefsSettings: prefsSettings, + workManagerSettings: workManagerSettings, + webSettings: webSettings, + ); + runApp(app); + }, ); } else { + await boot( + appConfig: appConfig, + themeConfig: themeConfig, + envSettings: envSettings, + localeConfig: localeConfig, + appConfigBuilder: appConfigBuilder, + localeConfigBuilder: localeConfigBuilder, + themeConfigBuilder: themeConfigBuilder, + envSettingsBuilder: envSettingsBuilder, + securePrefsSettings: securePrefsSettings, + prefsSettings: prefsSettings, + workManagerSettings: workManagerSettings, + webSettings: webSettings, + ); runApp(app); } } From e4ae6723175ee378f938804d8ffa133b4e171a43 Mon Sep 17 00:00:00 2001 From: basemosama Date: Thu, 21 May 2026 13:47:58 +0300 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20add=20appRunner=20support=20to=20ru?= =?UTF-8?q?nPlayx=20=E2=80=94=20allow=20custom=20app=20initialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add `PlayxAppRunner` typedef to support custom application execution logic - Deprecate `app` parameter in `runPlayx` in favor of the new `appRunner` parameter - Update `runPlayx` to await `resolvedAppRunner`, providing more control over the `runApp` execution flow - Update example application to use `appRunner` for starting the app --- example/lib/main.dart | 2 +- lib/src/playx.dart | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index d926737..d1b9343 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -15,7 +15,7 @@ void main() async { fileName: 'assets/env/keys.env', ), localeConfigBuilder: () => createLocaleConfig(), - app: const MyApp(), + appRunner: () => runApp(const MyApp()), //not necessary // sentryOptions: (options) { // options.dsn = AppConfig.sentryKey; diff --git a/lib/src/playx.dart b/lib/src/playx.dart index b4c9291..72c5d0d 100644 --- a/lib/src/playx.dart +++ b/lib/src/playx.dart @@ -11,6 +11,7 @@ typedef PlayxAppConfigBuilder = PlayXAppConfig Function(); typedef PlayxLocaleConfigBuilder = PlayxLocaleConfig Function(); typedef PlayxThemeConfigBuilder = PlayxThemeConfig Function(); typedef PlayxEnvSettingsBuilder = PlayxEnvSettings Function()?; +typedef PlayxAppRunner = FutureOr Function(); /// The Playx library provides a suite of utilities for app setup, configuration, and management. /// @@ -147,7 +148,7 @@ abstract class Playx { /// Wraps `runApp` to initialize and set up Playx packages before running the app. /// - /// [app]: The root widget of the application. + /// [appRunner]: Runs the application after Playx finishes booting. /// [appConfigBuilder]: A function that returns the app configuration. /// [localeConfigBuilder]: A function that returns the locale configuration. /// [themeConfigBuilder]: A function that returns the theme configuration. @@ -157,7 +158,7 @@ abstract class Playx { /// [envSettingsBuilder]: A function that returns optional environment settings. /// [sentryOptions]: Optional Sentry configuration for crash reporting. static Future runPlayx({ - required Widget app, + PlayxAppRunner? appRunner, PlayxAppConfigBuilder? appConfigBuilder, PlayxLocaleConfigBuilder? localeConfigBuilder, PlayxThemeConfigBuilder? themeConfigBuilder, @@ -169,6 +170,7 @@ abstract class Playx { FlutterOptionsConfiguration? sentryOptions, PlayxWebSettings webSettings = const PlayxWebSettings(), // Deprecated parameters + @Deprecated('Use appRunner instead.') Widget? app, @Deprecated('Use appConfigBuilder instead.') PlayXAppConfig? appConfig, @Deprecated('Use localeConfigBuilder instead.') PlayxLocaleConfig? localeConfig, @@ -200,6 +202,13 @@ abstract class Playx { (envSettingsBuilder == null && envSettings != null), 'Use either envSettingsBuilder or envSettings, not both.', ); + assert( + (appRunner != null && app == null) || + (appRunner == null && app != null), + 'Use either appRunner or app, not both.', + ); + + final resolvedAppRunner = appRunner ?? () => runApp(app!); if (sentryOptions != null) { await SentryFlutter.init( @@ -221,7 +230,7 @@ abstract class Playx { workManagerSettings: workManagerSettings, webSettings: webSettings, ); - runApp(app); + await Future.sync(resolvedAppRunner); }, ); } else { @@ -239,7 +248,7 @@ abstract class Playx { workManagerSettings: workManagerSettings, webSettings: webSettings, ); - runApp(app); + await Future.sync(resolvedAppRunner); } } From b6f33b753514f05583a4eb60ece891322421f77a Mon Sep 17 00:00:00 2001 From: basemosama Date: Thu, 21 May 2026 13:52:53 +0300 Subject: [PATCH 4/4] chore: update to v2.1.2 --- CHANGELOG.md | 6 ++++++ pubspec.yaml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f55ce..274e225 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.1.2 + +- Fix Playx boot initialization inside Sentry's `appRunner` zone. +- Add `appRunner` support to `runPlayx`. +- Deprecate the `app` parameter in `runPlayx`. + ## 2.1.0 - 2.1.1 ### Dependency Updates diff --git a/pubspec.yaml b/pubspec.yaml index 3d0f3ae..38a8a9b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: playx description: Playx eco system helps with redundant features as it provides many utilities for themes, widgets and more. -version: 2.1.1 +version: 2.1.2 homepage: https://sourcya.io repository: https://github.com/playx-flutter/playx issue_tracker: https://github.com/playx-flutter/playx/issues