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

outdated

简单好用的通知广播管理.

ksnotification #

A new Flutter plugin.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

/1、接口实现/ class _MyHomePageState extends State

@override void initState() { // TODO: implement initState super.initState(); /2、添加监听/ KSNotificationCenter.shard().addObserver(this, increment_counter); }

@override void dispose() { // TODO: implement dispose /5、移除监听/ KSNotificationCenter.shard().removeObserver(this, increment_counter); super.dispose(); }

/4、接收监听消息/ @override receiveNotify(Map message, String name) { if (name == increment_counter){ int value = message['num'] as int; setState(() { _counter += value; }); } }

void _incrementCounter() { /4、发送通知广播/ KSNotificationCenter.shard().post({'num':100}, increment_counter); }

@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children:

}

1
likes
0
pub points
0%
popularity

Publisher

unverified uploader

简单好用的通知广播管理.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on ksnotification