anlifecycle 1.0.4+2 copy "anlifecycle: ^1.0.4+2" to clipboard
anlifecycle: ^1.0.4+2 copied to clipboard

AnLifecycle draws on lifecycle in androidx to implement lifecycle on Flutter.

example/example.dart

import 'package:anlifecycle/anlifecycle.dart';
import 'package:flutter/material.dart';

import 'first.dart';
import 'home.dart';
import 'pageview.dart';
import 'second.dart';

void main() {
  runApp(const MyApp());
}

final routes = <String, WidgetBuilder>{
  '/': (context) => const MyHomePage(title: 'LifecycleApp'),
  '/first': (_) => const FistPage(),
  '/second': (_) => const SecondPage(),
  '/pageView': (_) => const PageViewExample(),
};

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

  @override
  Widget build(BuildContext context) {
    return LifecycleApp(
      child: MaterialApp(
        title: 'LifecycleApp Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        navigatorObservers: [LifecycleNavigatorObserver()],
        routes: routes.map(
          (key, value) => MapEntry(
              key, (_) => LifecycleRoutePage(child: Builder(builder: value))),
        ),
      ),
    );
  }
}
1
likes
0
pub points
41%
popularity

Publisher

verified publisheraymtools.com

AnLifecycle draws on lifecycle in androidx to implement lifecycle on Flutter.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on anlifecycle