Playx

pub package test License: MIT

Playx is an ecosystem for Flutter apps. One package boots preferences, environment, theme, localization, navigation, networking and widgets together, and gives you ready-made app widgets that wire them up.

Playx 3.0 requires Dart >=3.12.0 and Flutter >=3.44.0. Upgrading from 2.x? See the migration guide.

Features

  • Playx.runPlayx — boots everything in order, then runs your app. Works with Sentry and on web.
  • Clear boot errors — a failing step throws a PlayxBootException naming the step. Boot is idempotent and retryable, and async boot failures are logged and reported.
  • App widgets — PlayxMaterialApp, PlayxPlatformApp and GetX variants that connect theme, localization, navigation, screen sizing and Sentry.
  • Connection status — ConnectionStatusController for online/offline UI.
  • One import — re-exports the whole Playx ecosystem and common packages.

Install

dependencies:
  playx: ^3.0.0
import 'package:playx/playx.dart';

Quick start

void main() {
  Playx.runPlayx(
    appRunner: () => runApp(const MyApp()),
    appConfigBuilder: () => AppConfig(),
    themeConfigBuilder: createThemeConfig,
    localeConfigBuilder: createLocaleConfig,
    envSettingsBuilder: () => const PlayxEnvSettings(fileName: 'assets/env/keys.env'),
    // sentryOptions: (options) => options.dsn = 'https://...',
  );
}

class AppConfig extends PlayXAppConfig {
  @override
  Future<void> boot() async {
    Get.put<ApiClient>(ApiClient());
  }

  @override
  Future<void> asyncBoot() async {}
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) => const PlayxMaterialApp(
    appSettings: PlayxAppSettings(title: 'My app'),
    navigationSettings: PlayxNavigationSettings(home: HomePage()),
  );
}

Full walkthrough: Getting started.

Documentation

Getting started Install and create your first Playx app.
Booting Playx Boot order, errors, async boot, Sentry and web.
App widgets App widgets and all settings classes.
Connection status ConnectionStatusController.
Exports What package:playx/playx.dart re-exports.
Testing Testing apps that use Playx.
Migration to 3.0 Breaking changes and fixes.
Ecosystem Every Playx package and what changed in its latest version.

The Playx ecosystem

Package Version What it does
playx_core (guide) 2.0.0 Preferences, secure storage, env, logging, extensions.
playx_theme (guide) 2.1.0 Multi-theme management and animated switching.
playx_localization (guide) 1.0.0 Locales, translations without BuildContext, plurals.
playx_navigation (guide) 3.0.0 go_router with page lifecycle, scopes and guards.
playx_network (guide) 2.0.0 Dio wrapper returning typed results.
playx_widget (guide) 0.6.0 Utility widgets and app info.

Also see playx_version_update for update dialogs on Android and iOS.

Example

A runnable app is in example/.

cd example && flutter run

Contributing

flutter pub get
dart format lib test
flutter analyze lib test example
flutter test --coverage      # CI requires 90% coverage

See the changelog for release notes.

License

MIT — see LICENSE.

Libraries

playx