lifecycle 0.9.0 copy "lifecycle: ^0.9.0" to clipboard
lifecycle: ^0.9.0 copied to clipboard

A flutter package that let you easily add hooks for widget lifecycle.

example/lib/main.dart

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

import 'home_page.dart';
import 'list_page.dart';
import 'nav2_home.dart';
import 'nested_pageview.dart';
import 'overlay_log.dart';
import 'pageview.dart';
import 'sub1_page.dart';
import 'sub2_page.dart';
import 'tabview.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      navigatorObservers: [defaultLifecycleObserver],
      routes: {
        'sub1': (_) => const Sub1Page(),
        'sub2': (_) => const Sub2Page(),
        'pageview': (_) => const MyPageView(),
        'tabview': (_) => const MyTabView(),
        'nested': (_) => const NestedPageView(),
        'nav2': (_) => const Nav2Home(),
        'list': (_) => const ListPage(),
      },
      home: Builder(
        builder: (context) {
          LogEntry.init(context);
          return const HomePage();
        },
      ),
    );
  }
}
65
likes
160
points
4.98k
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package that let you easily add hooks for widget lifecycle.

Repository (GitHub)
View/report issues

Topics

#lifecycle #navigator-observer #app-lifecycle-state #app-lifecycle-listener #widgets-binding-observer

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on lifecycle