Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate plugin key: FLTGoogleMapsPlugin

I am trying to prepare a demo project using Google maps with flutter but don't know why getting crash with this error in console

Runner[39966:208120] *** Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: 'Duplicate plugin key:
FLTGoogleMapsPlugin'

I have followed this link flutter-io

Any help is appreciated thanks in advance.

like image 824
Nikunj Rajyaguru Avatar asked Aug 24 '26 15:08

Nikunj Rajyaguru


1 Answers

Just to clarify the comments and provide a final answer - you should be careful that [GeneratedPluginRegistrant registerWithRegistry:self] is not called twice in your AppDelegate.m file.

As per the Google Maps Flutter plugin readme, your AppDelegate.m should look like this:

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import "GoogleMaps/GoogleMaps.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      [GMSServices provideAPIKey:@"YOUR KEY HERE"];
      [GeneratedPluginRegistrant registerWithRegistry:self];
      return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end
like image 66
Aron Avatar answered Aug 27 '26 13:08

Aron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!