Stanford
Stanford

Reputation: 333

Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/ for many packages on Flutter

I'm getting the following error when I'm running my flutter application on IOS but works on android:

Unhandled Exception: MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore)

Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)

Upvotes: 1

Views: 1271

Answers (1)

Stanford
Stanford

Reputation: 333

I followed this: https://github.com/flutter/flutter/issues/10912

More specifically, for step 4, I was running the Kotlin, Swift version of Flutter. When I was setting up Firebase, I accidentally copied the initialization code that was given to me on Firebase for a new IOS app which we were not suppose to do for Flutter. So I ended up creating a new Flutter project, copying the ios/Runner/AppDelegate.swift to the same directory in my flutter project.

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)

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


For IOS using Objective C, you would copy the AppDelegate.m file under the directory ios/Runner/AppDelegate.m

For Android using Java, you would copy the MainActivity.java file.
For Android using Kotlin, you would copy the MainActivity.kt file.

Directory for android: android/app/src/main/kotlin/com/example/{YOUR APP NAME}/MainActivity.java or MainActivity.kt

Upvotes: 1

Related Questions