-
Notifications
You must be signed in to change notification settings - Fork 236
Closed
Labels
bugSomething isn't working as expectedSomething isn't working as expected
Description
Description
The plugins created by the CLI have wrong names on their native classes, which prevents to create and just starting using the generated code.
Steps To Reproduce
- Run
very_good create -t flutter_plugin hello - Enter on the app facing package and create an example app by
flutter create example - Run
flutter pub geton the example app - See error
Expected Behavior
The generated plugin should be generated in a working state
Additional Context
This are the inconsistency that I identified:
On Android
- The plugin class is stored on the wrong folder, on the pubspec its package is
com.example.verygoodcore.hello, but it is placed inside thesrc/main/kotlin/com/example/verygoodcorefolder, which is missing one additional folder calledhello. - The
pluginClasson the pubspec is also different from the name of the class on the source file, on the pubspec isHelloAndroidPlatformwhile on the source it isHelloPlugin
On iOS
- The podspec file is named
hello.podspecand should be namedhello_ios.podspec - The name attribute on the podspec file also is just
helloand should behello_ios - The imports on
HelloPlugin.mare missing the_iossuffix on the folders and file.
This is how it looks when the plugin is generated:
#import "HelloPlugin.h"
#if __has_include(<hello/hello-Swift.h>)
#import <hello/hello-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "hello-Swift.h"And changing to the following fixes:
#import "HelloPlugin.h"
#if __has_include(<hello_ios/hello_ios-Swift.h>)
#import <hello_ios/hello_ios-Swift.h>
#else
// Support project import fallback if the generated compatibility header
// is not copied when this plugin is created as a library.
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
#import "hello_ios-Swift.h"- The plugin class name is wrong on the plubspec, it is generated with
HelloIosPlatform, but the class name isSwiftHelloPlugin,
On MacOs
- Same issue with podspec error mentioned on the iOS
- The pubspec is using the
ioskey on theflutter/plugin/platformssection, when it should bemacos
Web seems to work flawless out of the box. I couldn't test on Linux/Windows.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't working as expectedSomething isn't working as expected