methodchannel 1.0.0+1 copy "methodchannel: ^1.0.0+1" to clipboard
methodchannel: ^1.0.0+1 copied to clipboard

outdated

A new Flutter project.

[toc]

https://github.com/adreamknight/methodChannel #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

MethodChannel #

flutter 调 native #

Dart实现 #

  1. 定义特定的MethodChannel,标识为“com.sicilyliu”
  2. 定义点击触发的Future方法,里面调用的MethodChannel.invokeMethod

swift实现 #

  1. 初始化FlutterViewController,FlutterMethodChannel
  2. 定义methodChannel.setMethodCallHandler,里面根据调过来的方法名和参数做相应处理

native 调 flutter #

swift实现 #

  1. 初始化FlutterViewController,FlutterMethodChannel
  2. 调用methodChannel.invokeMethod,传参方法名和参数

Dart代码 #

  1. 唤醒监听nativeMessageListener(),可以放在initState()里面
  2. 定义监听处理nativeMessageListener()的Future方法,根据调过来的方法名和参数做处理
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter project.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter

More

Packages that depend on methodchannel