forked from firka/flutter
Restructure Windows plugin template (#93511)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "include/{{projectName}}/{{pluginClassSnakeCase}}.h"
|
||||
#include "{{pluginClassSnakeCase}}.h"
|
||||
|
||||
// This must be included before many other Windows headers.
|
||||
#include <windows.h>
|
||||
@@ -10,26 +10,10 @@
|
||||
#include <flutter/plugin_registrar_windows.h>
|
||||
#include <flutter/standard_method_codec.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
namespace {
|
||||
|
||||
class {{pluginClass}} : public flutter::Plugin {
|
||||
public:
|
||||
static void RegisterWithRegistrar(flutter::PluginRegistrarWindows *registrar);
|
||||
|
||||
{{pluginClass}}();
|
||||
|
||||
virtual ~{{pluginClass}}();
|
||||
|
||||
private:
|
||||
// Called when a method is called on this plugin's channel from Dart.
|
||||
void HandleMethodCall(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &method_call,
|
||||
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result);
|
||||
};
|
||||
namespace {{projectName}} {
|
||||
|
||||
// static
|
||||
void {{pluginClass}}::RegisterWithRegistrar(
|
||||
@@ -72,11 +56,4 @@ void {{pluginClass}}::HandleMethodCall(
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void {{pluginClass}}RegisterWithRegistrar(
|
||||
FlutterDesktopPluginRegistrarRef registrar) {
|
||||
{{pluginClass}}::RegisterWithRegistrar(
|
||||
flutter::PluginRegistrarManager::GetInstance()
|
||||
->GetRegistrar<flutter::PluginRegistrarWindows>(registrar));
|
||||
}
|
||||
} // namespace {{projectName}}
|
||||
|
||||
Reference in New Issue
Block a user