Home > Software design >  How to pass obj-c NSDictionary to dart
How to pass obj-c NSDictionary to dart

Time:09-16

I have a plugin passing data from iOS side (NSDictionary with obj-c) to app (not sure what type with dart).

// obj-c
result.success(@{@"obj1" : obj, @"obj2" : @"value"});

// dart
var result = await channel.invokeMethod('methodName');

What type should to choice for result on dart side?

CodePudding user response:

I Use it like this

final result = await channel.invokeMethod('methodName');
Map<String, dynamic>data = Map<String, dynamic>.from(result);
  • Related