objcChannelInterfaceString top-level property

String objcChannelInterfaceString
getter/setter pair

Implementation

String objcChannelInterfaceString = '''
#import <Foundation/Foundation.h>
#import <Flutter/Flutter.h>

NS_ASSUME_NONNULL_BEGIN

@class #{projectPrefix}ChannelManager;

/// Protocol for channel manager method call
@protocol #{projectPrefix}ChannelManagerDelegate <NSObject>

- (void)manager:(#{projectPrefix}ChannelManager *)manager didReceviceMethodCall:(FlutterMethodCall *)methodCall;
- (void)manager:(#{projectPrefix}ChannelManager *)manager didHandleMethodCall:(FlutterMethodCall *)methodCall success:(BOOL)success;

@end

@interface #{projectPrefix}ChannelManager : NSObject

+ (instancetype)sharedManager;

@property (nonatomic, strong, readonly) FlutterMethodChannel *methodChannel;

@property (nonatomic, weak, nullable) id<#{projectPrefix}ChannelManagerDelegate> delegate;

/// initialize channel manager
/// @param messenger The binary messenger.
- (void)initializeWithBinaryMessenger:(NSObject<FlutterBinaryMessenger>*)messenger;

/// add an native implementation for a dart generated protocol
/// dart code with abstract methods will generated into a objc protocol
/// native implementation should conform to the generated protocol and implment
/// those abstract method.
/// @param implementation the native implementation class instance.
/// @param name the generated protocol name.
- (void)addMethodImplementation:(id)implementation withName:(NSString *)name;

/// Invoke a dart method
/// @param method the method's name
/// @param args the method's arguments
/// @param class caller's classType
/// @param completion the method's completion result
- (void)invokeMethod:(NSString *)method args:(nullable NSArray *)args fromClass:(Class)classType completion:(nullable void(^)(__nullable id result))completion;

@end

NS_ASSUME_NONNULL_END
''';