Skip to content

Use other plugins in callback

mehdi sohrabi edited this page Jul 18, 2021 · 4 revisions

Use other plugins in callback

Android

By Marcelo Henrique Neppel.

 no operation needed

iOS

in AppDelagate.swift add this lines to didFinishLaunchingWithOptions:

if !hasPlugin("io.flutter.plugins.pathprovider") {
    FLTPathProviderPlugin
        .register(with: registrar(forPlugin: "io.flutter.plugins.pathprovider"))
}

The method should look something like this:

override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication
            .LaunchOptionsKey: Any]?
    ) -> Bool {
        GeneratedPluginRegistrant.register(with: self)
        BackgroundLocatorPlugin.setPluginRegistrantCallback(registerPlugins)

        registerOtherPlugins()

        return super
            .application(application,
                         didFinishLaunchingWithOptions: launchOptions)
    }

    func registerOtherPlugins() {
        if !hasPlugin("io.flutter.plugins.pathprovider") {
            FLTPathProviderPlugin
                .register(with: registrar(forPlugin: "io.flutter.plugins.pathprovider"))
        }
    }
Clone this wiki locally