evento 1.0.0 evento: ^1.0.0 copied to clipboard
Dart/Flutter communication package based on events
import 'package:flutter/material.dart';
import 'package:evento/evento.dart';
class A extends StatelessWidget with EventoStatelessWidget {
Widget build(context) {
return MaterialButton(onPressed: () {
dispatch('foo', 'world');
});
}
}
class B extends StatefulWidget {
State createState() => _B();
}
class _B extends State<B> with Evento {
String value = 'Hey';
void initState() {
on('foo', (EEvent event) {
setState(() {
value = 'Hello ${event.data}';
});
});
}
Widget build(context) {
return Text(value);
}
}