Created
July 24, 2021 14:33
-
-
Save AbhishekDoshi26/3ca2eb2f3d657b64a5656adede6364f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AppDelegate.h" | |
#include "GeneratedPluginRegistrant.h" | |
@implementation AppDelegate | |
- | |
(BOOL) application: (UIApplication * ) application | |
didFinishLaunchingWithOptions: (NSDictionary * ) launchOptions { | |
FlutterViewController * controller = (FlutterViewController * ) self.window.rootViewController; | |
FlutterMethodChannel * nativeChannel = [FlutterMethodChannel | |
methodChannelWithName: @ "flutter.native/helperChannel" | |
binaryMessenger: controller | |
]; | |
__weak typeof (self) weakSelf = self; | |
[nativeChannel setMethodCallHandler: ^ (FlutterMethodCall * call, FlutterResult result) { | |
if ([@ "helloFromNativeCode" | |
isEqualToString: call.method | |
]) { | |
NSString * strNative = [weakSelf helloFromNativeCode]; | |
result(strNative); | |
} else { | |
result(FlutterMethodNotImplemented); | |
} | |
}]; | |
[GeneratedPluginRegistrant registerWithRegistry: self]; | |
return [super application: application didFinishLaunchingWithOptions: launchOptions]; | |
} - | |
(NSString * ) helloFromNativeCode { | |
return @ "Hello From Native IOS Code"; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment