Last active
April 22, 2018 10:00
-
-
Save ponnamkarthik/a54a2fa14ccc6f2a6a9f3b7782b1c370 to your computer and use it in GitHub Desktop.
FlutterNativeLogPlugin.m
This file contains hidden or 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
#import "FlutterNativeLogPlugin.h" | |
@implementation FlutterNativeLogPlugin | |
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { | |
FlutterMethodChannel* channel = [FlutterMethodChannel | |
methodChannelWithName:@"flutter_native_log" | |
binaryMessenger:[registrar messenger]]; | |
FlutterNativeLogPlugin* instance = [[FlutterNativeLogPlugin alloc] init]; | |
[registrar addMethodCallDelegate:instance channel:channel]; | |
} | |
- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { | |
if ([@"getPlatformVersion" isEqualToString:call.method]) { | |
result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]); | |
} else if([@"printLog" isEqualToStrin:call.method]) { | |
NSString *msg = call.arguments[@"msg"]; | |
NSString *tag = call.arguments[@"tag"]; | |
NSLog(@"%@: %@", tag, msg); | |
result(@"Logged Successfully!") | |
}else { | |
result(FlutterMethodNotImplemented); | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment