command_it 9.5.2 copy "command_it: ^9.5.2" to clipboard
command_it: ^9.5.2 copied to clipboard

Command pattern for Flutter that wraps sync/async functions as callable Command objects with automatic isRunning, error and result state exposed as ValueListenables.

example/lib/main.dart

import 'package:command_it/command_it.dart';
import 'package:flutter/material.dart';
import 'package:flutter_weather_demo/weather_manager.dart';

import 'homepage.dart';

void main() {
  Command.reportAllExceptions = true;
  Command.globalExceptionHandler = (ex, stack) {
    print(ex.toString());
    print(stack.toString());
  };

  runApp(MyApp());
}

/// In a real app you would use some locator like get_it or provider
/// to access your business objects. To keep the focus on the commands we use here
/// a global variable.
WeatherManager weatherManager = WeatherManager();

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Flutter Demo', home: HomePage());
  }
}
35
likes
160
points
5.5k
downloads
screenshot

Documentation

API reference

Publisher

verified publisherflutter-it.dev

Weekly Downloads

Command pattern for Flutter that wraps sync/async functions as callable Command objects with automatic isRunning, error and result state exposed as ValueListenables.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, listen_it, quiver, stack_trace

More

Packages that depend on command_it