speedex 0.0.2 copy "speedex: ^0.0.2" to clipboard
speedex: ^0.0.2 copied to clipboard

SpeedEx, short for "Speed Execution" is a lightweight and simple state management solution for Flutter, offering global state handling with minimal boilerplate.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:speedex/speedex.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: 'SpeedEx Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'SpeedEx Example Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  void initState() {
    super.initState();
    SpeedEx.initialize();
    SpeedEx.setValue('counter', 0);
  }

  void _incrementCounter() {
    int currentValue = SpeedEx.getValue('counter') ?? 0;
    SpeedEx.setValue('counter', currentValue + 1);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            SpeedExWidget<int>(
              stateKey: 'counter',
              builder: (context, value) {
                return Text(
                  '${value ?? 0}',
                  style: Theme.of(context).textTheme.headlineMedium,
                );
              },
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
5
likes
160
points
25
downloads

Publisher

verified publishermo-shaheen.wuaze.com

Weekly Downloads

SpeedEx, short for "Speed Execution" is a lightweight and simple state management solution for Flutter, offering global state handling with minimal boilerplate.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on speedex