call_platform.dart 710 B

12345678910111213141516171819202122
  1. import 'package:eitc_erm_app/utils/logger.dart';
  2. import 'package:flutter/services.dart';
  3. import 'package:flutter/services.dart';
  4. class NativeMethods {
  5. Future<void> launchAndroid() async {
  6. const platform = MethodChannel('com.example.xcx_dashan_app/channel');
  7. try {
  8. var result = await platform.invokeMethod('launchApp');
  9. // var result = await platform.invokeMethod('launchAppOne',{'param1': "这是一个参数"});
  10. // var result = await platform.invokeMethod('launchAppOne',{'param1': "这是一个参数",'param2': "这是一个参数"});
  11. logd("结果$result");
  12. } on PlatformException catch (e) {
  13. logd("Failed to invoke method: '${e.message}'.");
  14. }
  15. }
  16. }