| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #import "FLTGoogleMapsPlugin.h" |
| |
| #pragma mark - GoogleMaps plugin implementation |
| |
| @implementation FLTGoogleMapsPlugin { |
| NSObject<FlutterPluginRegistrar>* _registrar; |
| FlutterMethodChannel* _channel; |
| NSMutableDictionary* _mapControllers; |
| } |
| |
| + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar { |
| FLTGoogleMapFactory* googleMapFactory = [[FLTGoogleMapFactory alloc] initWithRegistrar:registrar]; |
| [registrar registerViewFactory:googleMapFactory withId:@"plugins.flutter.io/google_maps"]; |
| } |
| |
| - (FLTGoogleMapController*)mapFromCall:(FlutterMethodCall*)call error:(FlutterError**)error { |
| id mapId = call.arguments[@"map"]; |
| FLTGoogleMapController* controller = _mapControllers[mapId]; |
| if (!controller && error) { |
| *error = [FlutterError errorWithCode:@"unknown_map" message:nil details:mapId]; |
| } |
| return controller; |
| } |
| @end |