lite_state 2.4.7 copy "lite_state: ^2.4.7" to clipboard
lite_state: ^2.4.7 copied to clipboard

A simple state management machine for Flutter.

example/lib/main.dart

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

import 'lite_state_controllers/auth_controller.dart';
import 'lite_state_controllers/auth_data.dart';
import 'lite_state_controllers/loader_controller.dart';
import 'test_page.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    initJsonDecoders({
      AuthData: AuthData.decode,
    });

    initControllersLazy({
      AuthController: () => AuthController(),
      LoaderController: () => LoaderController(),
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.red,
      ),
      home: const TestPage(),
    );
  }
}