action_flow 1.0.0
action_flow: ^1.0.0 copied to clipboard
A user operation of executing the pipeline infrastructure library.
example/action_flow_example.dart
import 'package:action_flow/action_flow.dart';
import 'package:flutter/material.dart';
import 'analytics_interceptor_example.dart';
void main() {
// App 启动时初始化
ActionRunner.init(
ActionPipeline([
DebounceInterceptor(),
AnalyticsInterceptorExample(),
// VipInterceptor(), // 项目级
]),
);
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: IconButton(
icon: const Icon(Icons.send),
onPressed: () {
ActionRunner.run(
context,
tag: 'chat_send',
action: sendMessage,
);
},
),
);
}
Future<void> sendMessage() async {
// do something
}
}