# flutter_init **Repository Path**: mirrors_bamlab/flutter_init ## Basic Information - **Project Name**: flutter_init - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-12 - **Last Updated**: 2026-05-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # init

logo

A simple Flutter widget to declaratively execute initialization logic in your widget tree. Used internally at Theodo Apps ❤️💙💛.

Flutter widgets often require initialization logic (e.g., fetching data, setting up listeners) that is typically placed in `initState`, `didChangeDependencies`, or after the first frame. Managing this logic can lead to boilerplate and less reusable code, especially when you want to compose or reuse initialization patterns across widgets. **init** provides an `Init` widget that lets you declaratively specify initialization and disposal logic as parameters, making your code cleaner, more modular, and easier to test. ## Installation To use the `Init` widget, add `init` package to the dependencies: ```sh dart pub add init # or flutter pub add init ``` You can also add the package manually to your `pubspec.yaml`: ```yaml dependencies: init: ^1.0.0 ``` Then run: ```sh flutter pub get ``` ## Usage Wrap any widget with `Init` and provide the desired callbacks: ```dart import 'package:init/init.dart'; Init( onInit: () => print('Widget initialized'), onInitPostFrame: () => print('Widget initialized after frame'), onDidChangeDependencies: () => print('Dependencies changed'), onDispose: () => print('Widget disposed'), child: MyChildWidget(), ) ``` ### Parameters - `onInit`: Called once in `initState` (for one-time setup) - `onInitPostFrame`: Called once after the first frame is rendered - `onDidChangeDependencies`: Called in `didChangeDependencies` - `onDispose`: Called in `dispose` - `child`: The widget to render ## Example ```dart Init( onInit: () => print('Initializing...'), onDispose: () => print('Cleaning up...'), child: const Text('Hello!'), ) ``` ## 👉 About Theodo Apps We are a 130 people company developing and designing universal applications with [React Native](https://apps.theodo.com/expertise/react-native) and [Flutter](https://apps.theodo.com/expertise/flutter) using the Lean & Agile methodology. To get more information on the solutions that would suit your needs, feel free to get in touch by [email](mailto://contact-apps@theodo.com) or through or [contact form](https://apps.theodo.com/contact)! We will always answer you with pleasure 😁