yx_scope_flutter 1.0.1 copy "yx_scope_flutter: ^1.0.1" to clipboard
yx_scope_flutter: ^1.0.1 copied to clipboard

An adapter package that provides yx_scope widgets for Flutter UI integration

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:yx_scope/yx_scope.dart' hide ScopeListener;
import 'package:yx_scope_flutter/yx_scope_flutter.dart';

import 'di/app/app_scope.dart';
import 'utils/logger.dart';

Future<void> main() async {
  ScopeObservatory.logger = const Logger();
  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  final _appScopeHolder = AppScopeHolder();

  @override
  void initState() {
    super.initState();
    _appScopeHolder.create();
  }

  @override
  void dispose() {
    _appScopeHolder.drop();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return ScopeProvider(
      holder: _appScopeHolder,
      child: ScopeBuilder<AppScopeContainer>.withPlaceholder(
        builder: (context, appScope) {
          return MaterialApp.router(
            title: 'YxScopedFlutter Demo',
            theme: ThemeData(
              primarySwatch: Colors.blue,
            ),
            routerDelegate: appScope.routerDelegateDep.get,
          );
        },

        // Shows this widget while [appScopeHolder] is loading
        placeholder: const Center(child: CircularProgressIndicator()),
      ),
    );
  }
}
23
likes
150
pub points
37%
popularity

Publisher

verified publisherdev.go.yandex

An adapter package that provides yx_scope widgets for Flutter UI integration

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, yx_scope

More

Packages that depend on yx_scope_flutter