简体   繁体   中英

Flutter Obj-C plug-in how to get an argument?

This is what I'm using:

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  if ([@"loadImage" isEqualToString:call.method]) {
    NSData* data = UIImageJPEGRepresentation(call.arguments[@"filePath"], 0.8);
    result(@"success");
  } else {
    result(FlutterMethodNotImplemented);
  }

However, I'm not sure if it's call.arguments , that's what it is on Java.

How can I go about getting auto-completion for plugin writing?

是的, call.arguments是一个NSDictionary (参见Java HashMap ),因此您可以使用以下命令提取String参数:

NSString *value = call.arguments[@"argName"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM