esm 1.0.0 copy "esm: ^1.0.0" to clipboard
esm: ^1.0.0 copied to clipboard

discontinuedreplaced by: tilde
outdated

A Flutter package to simplify application state management using component.

example/lib/main.dart

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

void main() => runApp(~MyApp());

class MyApp extends Application {
  final counterState = 0.state;

  @override
  Widget render(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Demo Home Page'),
        ),
        body: Counter(counterState),
        floatingActionButton: FloatingActionButton(
          onPressed: () => counterState.value++,
          tooltip: 'Increment',
          child: const Icon(Icons.add),
        ),
      );
}

class Counter extends Component<int> {
  const Counter(super.state, {super.key});

  @override
  Widget render(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          const Text(
            'You have pushed the button this many times:',
          ),
          Text(
            '${state.value}',
            style: Theme.of(context).textTheme.headlineMedium,
          ),
          ElevatedButton(
            onPressed: () => state.value = 0,
            child: const Text('Reset'),
          ),
        ],
      ),
    );
  }
}
0
likes
0
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to simplify application state management using component.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

event, eventsubscriber, flutter, url_router

More

Packages that depend on esm