Flutter Engine
FlutterPluginMacOS.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #import <Foundation/Foundation.h>
6 
7 #import "FlutterChannels.h"
8 #import "FlutterCodecs.h"
9 #import "FlutterMacros.h"
10 
11 // TODO: Merge this file and FlutterPluginRegistrarMacOS.h with the iOS FlutterPlugin.h, sharing
12 // all but the platform-specific methods.
13 
14 @protocol FlutterPluginRegistrar;
15 
16 /**
17  * Implemented by the platform side of a Flutter plugin.
18  *
19  * Defines a set of optional callback methods and a method to set up the plugin
20  * and register it to be called by other application components.
21  *
22  * Currently the macOS version of FlutterPlugin has very limited functionality, but is expected to
23  * expand over time to more closely match the functionality of the iOS FlutterPlugin.
24  */
26 @protocol FlutterPlugin <NSObject>
27 
28 /**
29  * Creates an instance of the plugin to register with |registrar| using the desired
30  * FlutterPluginRegistrar methods.
31  */
32 + (void)registerWithRegistrar:(nonnull id<FlutterPluginRegistrar>)registrar;
33 
34 @optional
35 
36 /**
37  * Called when a message is sent from Flutter on a channel that a plugin instance has subscribed
38  * to via -[FlutterPluginRegistrar addMethodCallDelegate:channel:].
39  *
40  * The |result| callback must be called exactly once, with one of:
41  * - FlutterMethodNotImplemented, if the method call is unknown.
42  * - A FlutterError, if the method call was understood but there was a
43  * problem handling it.
44  * - Any other value (including nil) to indicate success. The value will
45  * be returned to the Flutter caller, and must be serializable to JSON.
46  */
47 - (void)handleMethodCall:(nonnull FlutterMethodCall*)call result:(nonnull FlutterResult)result;
48 
49 @end
void(^ FlutterResult)(id _Nullable result)
#define FLUTTER_EXPORT