diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md index e37a881cbd2e..fa6e19caf286 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md +++ b/packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.16.1 + +* Updates heatmaps passed between Dart and native to use typed data. + ## 2.16.0 * Adds compatibility with SDK version 10.x for apps targeting iOS 16+. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FGMConversionsUtilsTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FGMConversionsUtilsTests.m index 127f5b4c280f..7bdec2a54a5f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FGMConversionsUtilsTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FGMConversionsUtilsTests.m @@ -37,38 +37,37 @@ - (void)testGetValueOrNilWithNSNull { XCTAssertNil(FGMGetValueOrNilFromDict(dict, key)); } -- (void)testLocationFromLatLong { - NSArray *latlong = @[ @1, @2 ]; - CLLocationCoordinate2D location = [FGMHeatmapConversions locationFromLatLong:latlong]; - XCTAssertEqual(location.latitude, 1); - XCTAssertEqual(location.longitude, 2); -} - -- (void)testPointFromArray { - NSArray *array = @[ @1, @2 ]; - CGPoint point = [FGMHeatmapConversions pointFromArray:array]; - XCTAssertEqual(point.x, 1); - XCTAssertEqual(point.y, 2); -} - -- (void)testArrayFromLocation { - CLLocationCoordinate2D location = CLLocationCoordinate2DMake(1, 2); - NSArray *array = [FGMHeatmapConversions arrayFromLocation:location]; - XCTAssertEqual([array[0] integerValue], 1); - XCTAssertEqual([array[1] integerValue], 2); -} - -- (void)testColorFromRGBA { - NSNumber *rgba = @(0x01020304); - UIColor *color = [FGMHeatmapConversions colorFromRGBA:rgba]; +- (void)testColorFromPlatformColor { + double platformRed = 1 / 255.0; + double platformGreen = 2 / 255.0; + double platformBlue = 3 / 255.0; + double platformAlpha = 4 / 255.0; + UIColor *color = FGMGetColorForPigeonColor([FGMPlatformColor makeWithRed:platformRed + green:platformGreen + blue:platformBlue + alpha:platformAlpha]); CGFloat red, green, blue, alpha; BOOL success = [color getRed:&red green:&green blue:&blue alpha:&alpha]; XCTAssertTrue(success); const CGFloat accuracy = 0.0001; - XCTAssertEqualWithAccuracy(red, 2 / 255.0, accuracy); - XCTAssertEqualWithAccuracy(green, 3 / 255.0, accuracy); - XCTAssertEqualWithAccuracy(blue, 4 / 255.0, accuracy); - XCTAssertEqualWithAccuracy(alpha, 1 / 255.0, accuracy); + XCTAssertEqualWithAccuracy(red, platformRed, accuracy); + XCTAssertEqualWithAccuracy(green, platformGreen, accuracy); + XCTAssertEqualWithAccuracy(blue, platformBlue, accuracy); + XCTAssertEqualWithAccuracy(alpha, platformAlpha, accuracy); +} + +- (void)testPlatformColorFromColor { + double red = 1 / 255.0; + double green = 2 / 255.0; + double blue = 3 / 255.0; + double alpha = 4 / 255.0; + UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; + FGMPlatformColor *platformColor = FGMGetPigeonColorForColor(color); + const CGFloat accuracy = 0.0001; + XCTAssertEqualWithAccuracy(red, platformColor.red, accuracy); + XCTAssertEqualWithAccuracy(green, platformColor.green, accuracy); + XCTAssertEqualWithAccuracy(blue, platformColor.blue, accuracy); + XCTAssertEqualWithAccuracy(alpha, platformColor.alpha, accuracy); } - (void)testPointsFromLatLongs { @@ -386,53 +385,46 @@ - (void)testLengthsFromPatterns { XCTAssertEqual(secondSpanLength.doubleValue, dashLength); } -- (void)testWeightedLatLngFromArray { - NSArray *weightedLatLng = @[ @[ @1, @2 ], @3 ]; - - GMUWeightedLatLng *weightedLocation = - [FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]; - - // The location gets projected to different values - XCTAssertEqual([weightedLocation intensity], 3); -} - -- (void)testWeightedLatLngFromArrayThrowsForInvalidInput { - NSArray *weightedLatLng = @[]; - - XCTAssertThrows([FGMHeatmapConversions weightedLatLngFromArray:weightedLatLng]); -} - -- (void)testWeightedDataFromArray { - NSNumber *intensity1 = @3; - NSNumber *intensity2 = @6; - NSArray *data = @[ @[ @[ @1, @2 ], intensity1 ], @[ @[ @4, @5 ], intensity2 ] ]; +- (void)testWeightedDataFromPlatformWeightedData { + CGFloat intensity1 = 3.0; + CGFloat intensity2 = 6.0; + NSArray *data = @[ + [FGMPlatformWeightedLatLng makeWithPoint:[FGMPlatformLatLng makeWithLatitude:10 longitude:20] + weight:intensity1], + [FGMPlatformWeightedLatLng makeWithPoint:[FGMPlatformLatLng makeWithLatitude:30 longitude:40] + weight:intensity2], + ]; - NSArray *weightedData = [FGMHeatmapConversions weightedDataFromArray:data]; - XCTAssertEqual([weightedData[0] intensity], [intensity1 floatValue]); - XCTAssertEqual([weightedData[1] intensity], [intensity2 floatValue]); + NSArray *weightedData = FGMGetWeightedDataForPigeonWeightedData(data); + XCTAssertEqual([weightedData[0] intensity], intensity1); + XCTAssertEqual([weightedData[1] intensity], intensity2); } -- (void)testGradientFromDictionary { - NSNumber *startPoint = @0.6; - NSNumber *colorMapSize = @200; - NSDictionary *gradientData = @{ - @"colors" : @[ - // Color.fromARGB(255, 0, 255, 255) - @4278255615, - ], - @"startPoints" : @[ startPoint ], - @"colorMapSize" : colorMapSize, - }; - - GMUGradient *gradient = [FGMHeatmapConversions gradientFromDictionary:gradientData]; +- (void)testGradientFromPlatformGradient { + CGFloat startPoint = 0.6; + CGFloat platformRed = 0.1; + CGFloat platformGreen = 0.2; + CGFloat platformBlue = 0.3; + CGFloat platformAlpha = 0.4; + NSInteger colorMapSize = 200; + FGMPlatformHeatmapGradient *platformGradient = + [FGMPlatformHeatmapGradient makeWithColors:@[ [FGMPlatformColor makeWithRed:platformRed + green:platformGreen + blue:platformBlue + alpha:platformAlpha] ] + startPoints:@[ @(startPoint) ] + colorMapSize:colorMapSize]; + + GMUGradient *gradient = FGMGetGradientForPigeonHeatmapGradient(platformGradient); CGFloat red, green, blue, alpha; [[gradient colors][0] getRed:&red green:&green blue:&blue alpha:&alpha]; - XCTAssertEqual(red, 0); - XCTAssertEqual(green, 1); - XCTAssertEqual(blue, 1); - XCTAssertEqual(alpha, 1); - XCTAssertEqualWithAccuracy([[gradient startPoints][0] doubleValue], [startPoint doubleValue], 0); - XCTAssertEqual([gradient mapSize], [colorMapSize intValue]); + const CGFloat accuracy = 0.001; + XCTAssertEqualWithAccuracy(red, platformRed, accuracy); + XCTAssertEqualWithAccuracy(green, platformGreen, accuracy); + XCTAssertEqualWithAccuracy(blue, platformBlue, accuracy); + XCTAssertEqualWithAccuracy(alpha, platformAlpha, accuracy); + XCTAssertEqualWithAccuracy([[gradient startPoints][0] doubleValue], startPoint, accuracy); + XCTAssertEqual([gradient mapSize], colorMapSize); } @end diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FLTGoogleMapHeatmapControllerTests.m b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FLTGoogleMapHeatmapControllerTests.m index 2f345e02c571..d60ede8b8f13 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FLTGoogleMapHeatmapControllerTests.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/ios/RunnerTests/FLTGoogleMapHeatmapControllerTests.m @@ -22,21 +22,34 @@ @implementation GoogleMapsHeatmapControllerTests - (void)testUpdateHeatmapSetsVisibilityLast { PropertyOrderValidatingHeatmap *heatmap = [[PropertyOrderValidatingHeatmap alloc] init]; + FGMPlatformHeatmapGradient *gradient = [FGMPlatformHeatmapGradient makeWithColors:@[ + [FGMPlatformColor makeWithRed:0 green:0 blue:0 alpha:0], + [FGMPlatformColor makeWithRed:1.0 green:1.0 blue:1.0 alpha:1.0], + ] + startPoints:@[ @(0), @(1) ] + colorMapSize:256]; [FLTGoogleMapHeatmapController - updateHeatmap:heatmap - fromOptions:@{ - @"data" : @[ @[ @[ @(5), @(5) ], @(0.5) ], @[ @[ @(10), @(10) ], @(0.75) ] ], - @"gradient" : @{ - @"colors" : @[ @(0), @(1) ], - @"startPoints" : @[ @(0), @(1) ], - @"colorMapSize" : @(256), - }, - @"opacity" : @(0.5), - @"radius" : @(1), - @"minimumZoomIntensity" : @(1), - @"maximumZoomIntensity" : @(2), - } - withMapView:[GoogleMapsHeatmapControllerTests mapView]]; + updateHeatmap:heatmap + fromPlatformHeatmap:[FGMPlatformHeatmap + makeWithHeatmapId:@"heatmap" + data:@[ + [FGMPlatformWeightedLatLng + makeWithPoint:[FGMPlatformLatLng + makeWithLatitude:5.0 + longitude:5.0] + weight:0.5], + [FGMPlatformWeightedLatLng + makeWithPoint:[FGMPlatformLatLng + makeWithLatitude:10.0 + longitude:10.0] + weight:0.75], + ] + gradient:gradient + opacity:0.5 + radius:1 + minimumZoomIntensity:1 + maximumZoomIntensity:2] + withMapView:[GoogleMapsHeatmapControllerTests mapView]]; XCTAssertTrue(heatmap.hasSetMap); } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml index 125a5a2ac4d2..9558d5f831ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios14/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the google_maps_flutter plugin. publish_to: none environment: - sdk: ^3.8.0 - flutter: ">=3.32.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml index 125a5a2ac4d2..9558d5f831ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios15/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the google_maps_flutter plugin. publish_to: none environment: - sdk: ^3.8.0 - flutter: ">=3.32.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios16/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios16/pubspec.yaml index 125a5a2ac4d2..9558d5f831ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/ios16/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/ios16/pubspec.yaml @@ -3,8 +3,8 @@ description: Demonstrates how to use the google_maps_flutter plugin. publish_to: none environment: - sdk: ^3.8.0 - flutter: ">=3.32.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml index c29432c7f7aa..f7153eea3a30 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/example/shared/maps_example_dart/pubspec.yaml @@ -3,8 +3,8 @@ description: Shared Dart code for the example apps. publish_to: none environment: - sdk: ^3.8.0 - flutter: ">=3.32.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" dependencies: cupertino_icons: ^1.0.5 diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h index 2cc43fc538f6..d7c99ad04666 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.h @@ -64,13 +64,28 @@ extern FGMPlatformGroundOverlay *FGMGetPigeonGroundOverlay(GMSGroundOverlay *gro BOOL isCreatedWithBounds, NSNumber *_Nullable zoomLevel); +extern GMUGradient *FGMGetGradientForPigeonHeatmapGradient(FGMPlatformHeatmapGradient *gradient); + +extern FGMPlatformHeatmapGradient *FGMGetPigeonHeatmapGradientForGradient(GMUGradient *gradient); + +/// Creates a GMUWeightedLatLng array from its Pigeon equivalent. +extern NSArray *FGMGetWeightedDataForPigeonWeightedData( + NSArray *weightedLatLngs); + +/// Converts a GMUWeightedLatLng array to its Pigeon equivalent. +extern NSArray *FGMGetPigeonWeightedDataForWeightedData( + NSArray *weightedLatLngs); + /// Creates a GMSCameraUpdate from its Pigeon equivalent. extern GMSCameraUpdate *_Nullable FGMGetCameraUpdateForPigeonCameraUpdate( FGMPlatformCameraUpdate *update); -/// Creates a UIColor from its RGBA components, expressed as an integer. +/// Creates a UIColor from its Pigeon representation. extern UIColor *FGMGetColorForPigeonColor(FGMPlatformColor *color); +/// Converts a UIColor to its Pigeon representation. +extern FGMPlatformColor *FGMGetPigeonColorForColor(UIColor *color); + /// Creates an array of GMSStrokeStyles using the given patterns and stroke color. extern NSArray *FGMGetStrokeStylesFromPatterns( NSArray *patterns, UIColor *strokeColor); @@ -79,35 +94,4 @@ extern NSArray *FGMGetStrokeStylesFromPatterns( extern NSArray *FGMGetSpanLengthsFromPatterns( NSArray *patterns); -/// Legacy conversion utils for heatmaps, which are still using a JSON -/// representation instead of structured Pigeon data. -// TODO(stuartmorgan): Remove this once heatmaps are migrated to Pigeon. -@interface FGMHeatmapConversions : NSObject - -extern NSString *const kHeatmapsToAddKey; -extern NSString *const kHeatmapIdKey; -extern NSString *const kHeatmapDataKey; -extern NSString *const kHeatmapGradientKey; -extern NSString *const kHeatmapOpacityKey; -extern NSString *const kHeatmapRadiusKey; -extern NSString *const kHeatmapMinimumZoomIntensityKey; -extern NSString *const kHeatmapMaximumZoomIntensityKey; -extern NSString *const kHeatmapGradientColorsKey; -extern NSString *const kHeatmapGradientStartPointsKey; -extern NSString *const kHeatmapGradientColorMapSizeKey; - -+ (CLLocationCoordinate2D)locationFromLatLong:(NSArray *)latlong; -+ (CGPoint)pointFromArray:(NSArray *)array; -+ (NSArray *)arrayFromLocation:(CLLocationCoordinate2D)location; -+ (UIColor *)colorFromRGBA:(NSNumber *)data; -+ (NSNumber *)RGBAFromColor:(UIColor *)color; -+ (nullable GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data; -+ (NSArray *)arrayFromWeightedLatLng:(GMUWeightedLatLng *)weightedLatLng; -+ (NSArray *)weightedDataFromArray:(NSArray *> *)data; -+ (NSArray *> *)arrayFromWeightedData:(NSArray *)weightedData; -+ (GMUGradient *)gradientFromDictionary:(NSDictionary *)data; -+ (NSDictionary *)dictionaryFromGradient:(GMUGradient *)gradient; - -@end - NS_ASSUME_NONNULL_END diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m index bce17ba10af8..876ec0d1e4aa 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FGMConversionUtils.m @@ -169,6 +169,50 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { } } +GMUGradient *FGMGetGradientForPigeonHeatmapGradient(FGMPlatformHeatmapGradient *gradient) { + NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:gradient.colors.count]; + for (FGMPlatformColor *color in gradient.colors) { + [colors addObject:FGMGetColorForPigeonColor(color)]; + } + return [[GMUGradient alloc] initWithColors:colors + startPoints:gradient.startPoints + colorMapSize:gradient.colorMapSize]; +} + +FGMPlatformHeatmapGradient *FGMGetPigeonHeatmapGradientForGradient(GMUGradient *gradient) { + NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:gradient.colors.count]; + for (UIColor *color in gradient.colors) { + [colors addObject:FGMGetPigeonColorForColor(color)]; + } + return [FGMPlatformHeatmapGradient makeWithColors:colors + startPoints:gradient.startPoints + colorMapSize:gradient.mapSize]; +} + +NSArray *FGMGetWeightedDataForPigeonWeightedData( + NSArray *weightedLatLngs) { + NSMutableArray *weightedData = [[NSMutableArray alloc] initWithCapacity:weightedLatLngs.count]; + for (FGMPlatformWeightedLatLng *weightedLatLng in weightedLatLngs) { + [weightedData + addObject:[[GMUWeightedLatLng alloc] + initWithCoordinate:FGMGetCoordinateForPigeonLatLng(weightedLatLng.point) + intensity:weightedLatLng.weight]]; + } + return weightedData; +} + +NSArray *FGMGetPigeonWeightedDataForWeightedData( + NSArray *weightedLatLngs) { + NSMutableArray *weightedData = [[NSMutableArray alloc] initWithCapacity:weightedLatLngs.count]; + for (GMUWeightedLatLng *weightedLatLng in weightedLatLngs) { + GMSMapPoint point = {weightedLatLng.point.x, weightedLatLng.point.y}; + [weightedData addObject:[FGMPlatformWeightedLatLng + makeWithPoint:FGMGetPigeonLatLngForCoordinate(GMSUnproject(point)) + weight:weightedLatLng.intensity]]; + } + return weightedData; +} + GMSCameraUpdate *FGMGetCameraUpdateForPigeonCameraUpdate(FGMPlatformCameraUpdate *cameraUpdate) { // See note in messages.dart for why this is so loosely typed. id update = cameraUpdate.cameraUpdate; @@ -217,6 +261,12 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { return [UIColor colorWithRed:color.red green:color.green blue:color.blue alpha:color.alpha]; } +FGMPlatformColor *FGMGetPigeonColorForColor(UIColor *color) { + double red, green, blue, alpha; + [color getRed:&red green:&green blue:&blue alpha:&alpha]; + return [FGMPlatformColor makeWithRed:red green:green blue:blue alpha:alpha]; +} + NSArray *FGMGetStrokeStylesFromPatterns( NSArray *patterns, UIColor *strokeColor) { NSMutableArray *strokeStyles = [[NSMutableArray alloc] initWithCapacity:[patterns count]]; @@ -236,112 +286,3 @@ GMSMapViewType FGMGetMapViewTypeForPigeonMapType(FGMPlatformMapType type) { } return lengths; } - -@implementation FGMHeatmapConversions - -// These constants must match the corresponding constants in serialization.dart -NSString *const kHeatmapsToAddKey = @"heatmapsToAdd"; -NSString *const kHeatmapIdKey = @"heatmapId"; -NSString *const kHeatmapDataKey = @"data"; -NSString *const kHeatmapGradientKey = @"gradient"; -NSString *const kHeatmapOpacityKey = @"opacity"; -NSString *const kHeatmapRadiusKey = @"radius"; -NSString *const kHeatmapMinimumZoomIntensityKey = @"minimumZoomIntensity"; -NSString *const kHeatmapMaximumZoomIntensityKey = @"maximumZoomIntensity"; -NSString *const kHeatmapGradientColorsKey = @"colors"; -NSString *const kHeatmapGradientStartPointsKey = @"startPoints"; -NSString *const kHeatmapGradientColorMapSizeKey = @"colorMapSize"; - -+ (CLLocationCoordinate2D)locationFromLatLong:(NSArray *)latlong { - return CLLocationCoordinate2DMake([latlong[0] doubleValue], [latlong[1] doubleValue]); -} - -+ (CGPoint)pointFromArray:(NSArray *)array { - return CGPointMake([array[0] doubleValue], [array[1] doubleValue]); -} - -+ (NSArray *)arrayFromLocation:(CLLocationCoordinate2D)location { - return @[ @(location.latitude), @(location.longitude) ]; -} - -+ (UIColor *)colorFromRGBA:(NSNumber *)numberColor { - NSInteger rgba = numberColor.unsignedLongValue; - return [UIColor colorWithRed:((CGFloat)((rgba & 0xFF0000) >> 16)) / 255.0 - green:((CGFloat)((rgba & 0xFF00) >> 8)) / 255.0 - blue:((CGFloat)(rgba & 0xFF)) / 255.0 - alpha:((CGFloat)((rgba & 0xFF000000) >> 24)) / 255.0]; -} - -+ (NSNumber *)RGBAFromColor:(UIColor *)color { - CGFloat red, green, blue, alpha; - [color getRed:&red green:&green blue:&blue alpha:&alpha]; - unsigned long value = ((unsigned long)(alpha * 255) << 24) | ((unsigned long)(red * 255) << 16) | - ((unsigned long)(green * 255) << 8) | ((unsigned long)(blue * 255)); - return @(value); -} - -+ (GMUWeightedLatLng *)weightedLatLngFromArray:(NSArray *)data { - NSAssert(data.count == 2, @"WeightedLatLng data must have length of 2"); - if (data.count != 2) { - return nil; - } - return [[GMUWeightedLatLng alloc] - initWithCoordinate:[FGMHeatmapConversions locationFromLatLong:data[0]] - intensity:[data[1] doubleValue]]; -} - -+ (NSArray *)arrayFromWeightedLatLng:(GMUWeightedLatLng *)weightedLatLng { - GMSMapPoint point = {weightedLatLng.point.x, weightedLatLng.point.y}; - return @[ - [FGMHeatmapConversions arrayFromLocation:GMSUnproject(point)], @(weightedLatLng.intensity) - ]; -} - -+ (NSArray *)weightedDataFromArray:(NSArray *> *)data { - NSMutableArray *weightedData = - [[NSMutableArray alloc] initWithCapacity:data.count]; - for (NSArray *item in data) { - GMUWeightedLatLng *weightedLatLng = [FGMHeatmapConversions weightedLatLngFromArray:item]; - if (weightedLatLng == nil) continue; - [weightedData addObject:weightedLatLng]; - } - - return weightedData; -} - -+ (NSArray *> *)arrayFromWeightedData:(NSArray *)weightedData { - NSMutableArray *data = [[NSMutableArray alloc] initWithCapacity:weightedData.count]; - for (GMUWeightedLatLng *weightedLatLng in weightedData) { - [data addObject:[FGMHeatmapConversions arrayFromWeightedLatLng:weightedLatLng]]; - } - - return data; -} - -+ (GMUGradient *)gradientFromDictionary:(NSDictionary *)data { - NSArray *colorData = data[kHeatmapGradientColorsKey]; - NSMutableArray *colors = [[NSMutableArray alloc] initWithCapacity:colorData.count]; - for (NSNumber *colorCode in colorData) { - [colors addObject:[FGMHeatmapConversions colorFromRGBA:colorCode]]; - } - - return [[GMUGradient alloc] initWithColors:colors - startPoints:data[kHeatmapGradientStartPointsKey] - colorMapSize:[data[kHeatmapGradientColorMapSizeKey] intValue]]; -} - -+ (NSDictionary *)dictionaryFromGradient:(GMUGradient *)gradient { - NSMutableArray *colorCodes = - [[NSMutableArray alloc] initWithCapacity:gradient.colors.count]; - for (UIColor *color in gradient.colors) { - [colorCodes addObject:[FGMHeatmapConversions RGBAFromColor:color]]; - } - - return @{ - kHeatmapGradientColorsKey : colorCodes, - kHeatmapGradientStartPointsKey : gradient.startPoints, - kHeatmapGradientColorMapSizeKey : @(gradient.mapSize) - }; -} - -@end diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.h index abec532f2b0a..e0337eedfa02 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.h @@ -16,30 +16,16 @@ NS_ASSUME_NONNULL_BEGIN /// Initializes an instance of this class with a heatmap tile layer, a map view, and additional /// configuration options. /// -/// @param heatmapTileLayer The heatmap tile layer (of type GMUHeatmapTileLayer) that will be used -/// to display heatmap data on the map. -/// @param mapView The map view (of type GMSMapView) where the heatmap layer will be overlaid. -/// @param options A dictionary (NSDictionary) containing any additional options or configuration -/// settings for customizing the heatmap layer. The options dictionary is expected to have the -/// following structure: -/// -/// @code -/// { -/// "heatmapId": NSString, -/// "data": NSArray, // Array of serialized weighted lat/lng -/// "gradient": NSDictionary?, // Serialized heatmap gradient -/// "opacity": NSNumber, -/// "radius": NSNumber, -/// "minimumZoomIntensity": NSNumber, -/// "maximumZoomIntensity": NSNumber -/// } -/// @endcode +/// @param heatmap The heatmap data to display. +/// @param heatmapTileLayer The heatmap tile layer that will be used to display heatmap data on the +/// map. +/// @param mapView The map view where the heatmap layer will be overlaid. /// /// @return An initialized instance of this class, configured with the specified heatmap tile layer, /// map view, and additional options. -- (instancetype)initWithHeatmapTileLayer:(GMUHeatmapTileLayer *)heatmapTileLayer - mapView:(GMSMapView *)mapView - options:(NSDictionary *)options; +- (instancetype)initWithHeatmap:(FGMPlatformHeatmap *)heatmap + tileLayer:(GMUHeatmapTileLayer *)heatmapTileLayer + mapView:(GMSMapView *)mapView; /// Removes this heatmap from the map. - (void)removeHeatmap; @@ -66,9 +52,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns true if a heatmap with the given identifier exists on the map. - (BOOL)hasHeatmapWithIdentifier:(NSString *)identifier; -/// Returns the JSON data of the heatmap with the given identifier. The JSON structure is equivalent -/// to the `options` parameter above. -- (nullable NSDictionary *)heatmapInfoWithIdentifier:(NSString *)identifier; +/// Returns the heatmap with the given identifier. +- (nullable FGMPlatformHeatmap *)heatmapWithIdentifier:(NSString *)identifier; @end NS_ASSUME_NONNULL_END diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m index 808c5848768e..91c93933308d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController.m @@ -20,16 +20,16 @@ @interface FLTGoogleMapHeatmapController () @end @implementation FLTGoogleMapHeatmapController -- (instancetype)initWithHeatmapTileLayer:(GMUHeatmapTileLayer *)heatmapTileLayer - mapView:(GMSMapView *)mapView - options:(NSDictionary *)options { +- (instancetype)initWithHeatmap:(FGMPlatformHeatmap *)heatmap + tileLayer:(GMUHeatmapTileLayer *)heatmapTileLayer + mapView:(GMSMapView *)mapView { self = [super init]; if (self) { _heatmapTileLayer = heatmapTileLayer; _mapView = mapView; [FLTGoogleMapHeatmapController updateHeatmap:_heatmapTileLayer - fromOptions:options + fromPlatformHeatmap:heatmap withMapView:_mapView]; } return self; @@ -43,46 +43,23 @@ - (void)clearTileCache { [_heatmapTileLayer clearTileCache]; } -- (void)interpretHeatmapOptions:(NSDictionary *)data { +- (void)updateFromPlatformHeatmap:(FGMPlatformHeatmap *)platformHeatmap { [FLTGoogleMapHeatmapController updateHeatmap:_heatmapTileLayer - fromOptions:data + fromPlatformHeatmap:platformHeatmap withMapView:_mapView]; } + (void)updateHeatmap:(GMUHeatmapTileLayer *)heatmapTileLayer - fromOptions:(NSDictionary *)options - withMapView:(GMSMapView *)mapView { - // TODO(stuartmorgan): Migrate this to Pigeon. See - // https://github.com/flutter/flutter/issues/117907 - id weightedData = options[kHeatmapDataKey]; - if ([weightedData isKindOfClass:[NSArray class]]) { - heatmapTileLayer.weightedData = [FGMHeatmapConversions weightedDataFromArray:weightedData]; - } - - id gradient = options[kHeatmapGradientKey]; - if ([gradient isKindOfClass:[NSDictionary class]]) { - heatmapTileLayer.gradient = [FGMHeatmapConversions gradientFromDictionary:gradient]; - } - - id opacity = options[kHeatmapOpacityKey]; - if ([opacity isKindOfClass:[NSNumber class]]) { - heatmapTileLayer.opacity = [opacity doubleValue]; - } - - id radius = options[kHeatmapRadiusKey]; - if ([radius isKindOfClass:[NSNumber class]]) { - heatmapTileLayer.radius = [radius intValue]; - } - - id minimumZoomIntensity = options[kHeatmapMinimumZoomIntensityKey]; - if ([minimumZoomIntensity isKindOfClass:[NSNumber class]]) { - heatmapTileLayer.minimumZoomIntensity = [minimumZoomIntensity intValue]; - } - - id maximumZoomIntensity = options[kHeatmapMaximumZoomIntensityKey]; - if ([maximumZoomIntensity isKindOfClass:[NSNumber class]]) { - heatmapTileLayer.maximumZoomIntensity = [maximumZoomIntensity intValue]; + fromPlatformHeatmap:(FGMPlatformHeatmap *)platformHeatmap + withMapView:(GMSMapView *)mapView { + heatmapTileLayer.weightedData = FGMGetWeightedDataForPigeonWeightedData(platformHeatmap.data); + if (platformHeatmap.gradient) { + heatmapTileLayer.gradient = FGMGetGradientForPigeonHeatmapGradient(platformHeatmap.gradient); } + heatmapTileLayer.opacity = platformHeatmap.opacity; + heatmapTileLayer.radius = platformHeatmap.radius; + heatmapTileLayer.minimumZoomIntensity = platformHeatmap.minimumZoomIntensity; + heatmapTileLayer.maximumZoomIntensity = platformHeatmap.maximumZoomIntensity; // The map must be set each time for options to update. // This must be done last, to avoid visual flickers of default property values. @@ -113,22 +90,20 @@ - (instancetype)initWithMapView:(GMSMapView *)mapView { - (void)addHeatmaps:(NSArray *)heatmapsToAdd { for (FGMPlatformHeatmap *heatmap in heatmapsToAdd) { - NSString *heatmapId = [FLTHeatmapsController identifierForHeatmap:heatmap.json]; GMUHeatmapTileLayer *heatmapTileLayer = [[GMUHeatmapTileLayer alloc] init]; FLTGoogleMapHeatmapController *controller = - [[FLTGoogleMapHeatmapController alloc] initWithHeatmapTileLayer:heatmapTileLayer - mapView:_mapView - options:heatmap.json]; - _heatmapIdToController[heatmapId] = controller; + [[FLTGoogleMapHeatmapController alloc] initWithHeatmap:heatmap + tileLayer:heatmapTileLayer + mapView:_mapView]; + _heatmapIdToController[heatmap.heatmapId] = controller; } } - (void)changeHeatmaps:(NSArray *)heatmapsToChange { for (FGMPlatformHeatmap *heatmap in heatmapsToChange) { - NSString *heatmapId = [FLTHeatmapsController identifierForHeatmap:heatmap.json]; - FLTGoogleMapHeatmapController *controller = _heatmapIdToController[heatmapId]; + FLTGoogleMapHeatmapController *controller = _heatmapIdToController[heatmap.heatmapId]; - [controller interpretHeatmapOptions:heatmap.json]; + [controller updateFromPlatformHeatmap:heatmap]; [controller clearTileCache]; } } @@ -148,24 +123,18 @@ - (BOOL)hasHeatmapWithIdentifier:(NSString *)identifier { return _heatmapIdToController[identifier] != nil; } -- (nullable NSDictionary *)heatmapInfoWithIdentifier:(NSString *)identifier { - FLTGoogleMapHeatmapController *heatmapController = self.heatmapIdToController[identifier]; - if (heatmapController) { - return @{ - kHeatmapDataKey : [FGMHeatmapConversions - arrayFromWeightedData:heatmapController.heatmapTileLayer.weightedData], - kHeatmapGradientKey : [FGMHeatmapConversions - dictionaryFromGradient:heatmapController.heatmapTileLayer.gradient], - kHeatmapOpacityKey : @(heatmapController.heatmapTileLayer.opacity), - kHeatmapRadiusKey : @(heatmapController.heatmapTileLayer.radius), - kHeatmapMinimumZoomIntensityKey : @(heatmapController.heatmapTileLayer.minimumZoomIntensity), - kHeatmapMaximumZoomIntensityKey : @(heatmapController.heatmapTileLayer.maximumZoomIntensity) - }; +- (FGMPlatformHeatmap *)heatmapWithIdentifier:(NSString *)identifier { + GMUHeatmapTileLayer *heatmap = self.heatmapIdToController[identifier].heatmapTileLayer; + if (!heatmap) { + return nil; } - return nil; -} - -+ (NSString *)identifierForHeatmap:(NSDictionary *)heatmap { - return heatmap[kHeatmapIdKey]; + return [FGMPlatformHeatmap + makeWithHeatmapId:identifier + data:FGMGetPigeonWeightedDataForWeightedData(heatmap.weightedData) + gradient:FGMGetPigeonHeatmapGradientForGradient(heatmap.gradient) + opacity:heatmap.opacity + radius:heatmap.radius + minimumZoomIntensity:heatmap.minimumZoomIntensity + maximumZoomIntensity:heatmap.maximumZoomIntensity]; } @end diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController_Test.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController_Test.h index 36bb9f559c25..b00a48e3477f 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController_Test.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapHeatmapController_Test.h @@ -7,11 +7,11 @@ /// Internal APIs exposed for unit testing @interface FLTGoogleMapHeatmapController (Test) -/// Updates the underlying GMUHeatmapTileLayer with the properties from the given options. +/// Updates the underlying GMUHeatmapTileLayer with the properties from the given platform heatmap. /// /// Setting the heatmap to visible will set its map to the given mapView. + (void)updateHeatmap:(GMUHeatmapTileLayer *)heatmapTileLayer - fromOptions:(NSDictionary *)options - withMapView:(GMSMapView *)mapView; + fromPlatformHeatmap:(FGMPlatformHeatmap *)platformHeatmap + withMapView:(GMSMapView *)mapView; @end diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m index dc8d6fa6db2b..187a1a2526b7 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/GoogleMapController.m @@ -793,12 +793,7 @@ - (nullable NSNumber *)areZoomGesturesEnabledWithError: - (nullable FGMPlatformHeatmap *) heatmapWithIdentifier:(nonnull NSString *)heatmapId error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error { - NSDictionary *heatmapInfo = - [self.controller.heatmapsController heatmapInfoWithIdentifier:heatmapId]; - if (!heatmapInfo) { - return nil; - } - return [FGMPlatformHeatmap makeWithJson:heatmapInfo]; + return [self.controller.heatmapsController heatmapWithIdentifier:heatmapId]; } - (nullable NSArray *) diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h index fc8146dd0b41..56b84fdb30ae 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.h @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon #import @@ -78,6 +78,8 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @class FGMPlatformCameraUpdateZoomTo; @class FGMPlatformCircle; @class FGMPlatformHeatmap; +@class FGMPlatformHeatmapGradient; +@class FGMPlatformWeightedLatLng; @class FGMPlatformInfoWindow; @class FGMPlatformCluster; @class FGMPlatformClusterManager; @@ -229,11 +231,45 @@ typedef NS_ENUM(NSUInteger, FGMPlatformMapBitmapScaling) { @interface FGMPlatformHeatmap : NSObject /// `init` unavailable to enforce nonnull fields, see the `make` class method. - (instancetype)init NS_UNAVAILABLE; -+ (instancetype)makeWithJson:(id)json; -/// The heatmap data, as JSON. This should only be set from -/// Heatmap.toJson, and the native code must interpret it according to the -/// internal implementation details of that method. -@property(nonatomic, strong) id json; ++ (instancetype)makeWithHeatmapId:(NSString *)heatmapId + data:(NSArray *)data + gradient:(nullable FGMPlatformHeatmapGradient *)gradient + opacity:(double)opacity + radius:(NSInteger)radius + minimumZoomIntensity:(NSInteger)minimumZoomIntensity + maximumZoomIntensity:(NSInteger)maximumZoomIntensity; +@property(nonatomic, copy) NSString *heatmapId; +@property(nonatomic, copy) NSArray *data; +@property(nonatomic, strong, nullable) FGMPlatformHeatmapGradient *gradient; +@property(nonatomic, assign) double opacity; +@property(nonatomic, assign) NSInteger radius; +@property(nonatomic, assign) NSInteger minimumZoomIntensity; +@property(nonatomic, assign) NSInteger maximumZoomIntensity; +@end + +/// Pigeon equivalent of the HeatmapGradient class. +/// +/// The GMUGradient structure is slightly different from HeatmapGradient, so +/// this matches the iOS API so that conversion can be done on the Dart side +/// where the structures are easier to work with. +@interface FGMPlatformHeatmapGradient : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)makeWithColors:(NSArray *)colors + startPoints:(NSArray *)startPoints + colorMapSize:(NSInteger)colorMapSize; +@property(nonatomic, copy) NSArray *colors; +@property(nonatomic, copy) NSArray *startPoints; +@property(nonatomic, assign) NSInteger colorMapSize; +@end + +/// Pigeon equivalent of the WeightedLatLng class. +@interface FGMPlatformWeightedLatLng : NSObject +/// `init` unavailable to enforce nonnull fields, see the `make` class method. +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)makeWithPoint:(FGMPlatformLatLng *)point weight:(double)weight; +@property(nonatomic, strong) FGMPlatformLatLng *point; +@property(nonatomic, assign) double weight; @end /// Pigeon equivalent of the InfoWindow class. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m index 86a485af865a..a3f01df0636b 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m +++ b/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/messages.g.m @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon #import "messages.g.h" @@ -155,6 +155,18 @@ + (nullable FGMPlatformHeatmap *)nullableFromList:(NSArray *)list; - (NSArray *)toList; @end +@interface FGMPlatformHeatmapGradient () ++ (FGMPlatformHeatmapGradient *)fromList:(NSArray *)list; ++ (nullable FGMPlatformHeatmapGradient *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; +@end + +@interface FGMPlatformWeightedLatLng () ++ (FGMPlatformWeightedLatLng *)fromList:(NSArray *)list; ++ (nullable FGMPlatformWeightedLatLng *)nullableFromList:(NSArray *)list; +- (NSArray *)toList; +@end + @interface FGMPlatformInfoWindow () + (FGMPlatformInfoWindow *)fromList:(NSArray *)list; + (nullable FGMPlatformInfoWindow *)nullableFromList:(NSArray *)list; @@ -617,14 +629,32 @@ + (nullable FGMPlatformCircle *)nullableFromList:(NSArray *)list { @end @implementation FGMPlatformHeatmap -+ (instancetype)makeWithJson:(id)json { ++ (instancetype)makeWithHeatmapId:(NSString *)heatmapId + data:(NSArray *)data + gradient:(nullable FGMPlatformHeatmapGradient *)gradient + opacity:(double)opacity + radius:(NSInteger)radius + minimumZoomIntensity:(NSInteger)minimumZoomIntensity + maximumZoomIntensity:(NSInteger)maximumZoomIntensity { FGMPlatformHeatmap *pigeonResult = [[FGMPlatformHeatmap alloc] init]; - pigeonResult.json = json; + pigeonResult.heatmapId = heatmapId; + pigeonResult.data = data; + pigeonResult.gradient = gradient; + pigeonResult.opacity = opacity; + pigeonResult.radius = radius; + pigeonResult.minimumZoomIntensity = minimumZoomIntensity; + pigeonResult.maximumZoomIntensity = maximumZoomIntensity; return pigeonResult; } + (FGMPlatformHeatmap *)fromList:(NSArray *)list { FGMPlatformHeatmap *pigeonResult = [[FGMPlatformHeatmap alloc] init]; - pigeonResult.json = GetNullableObjectAtIndex(list, 0); + pigeonResult.heatmapId = GetNullableObjectAtIndex(list, 0); + pigeonResult.data = GetNullableObjectAtIndex(list, 1); + pigeonResult.gradient = GetNullableObjectAtIndex(list, 2); + pigeonResult.opacity = [GetNullableObjectAtIndex(list, 3) doubleValue]; + pigeonResult.radius = [GetNullableObjectAtIndex(list, 4) integerValue]; + pigeonResult.minimumZoomIntensity = [GetNullableObjectAtIndex(list, 5) integerValue]; + pigeonResult.maximumZoomIntensity = [GetNullableObjectAtIndex(list, 6) integerValue]; return pigeonResult; } + (nullable FGMPlatformHeatmap *)nullableFromList:(NSArray *)list { @@ -632,7 +662,66 @@ + (nullable FGMPlatformHeatmap *)nullableFromList:(NSArray *)list { } - (NSArray *)toList { return @[ - self.json ?: [NSNull null], + self.heatmapId ?: [NSNull null], + self.data ?: [NSNull null], + self.gradient ?: [NSNull null], + @(self.opacity), + @(self.radius), + @(self.minimumZoomIntensity), + @(self.maximumZoomIntensity), + ]; +} +@end + +@implementation FGMPlatformHeatmapGradient ++ (instancetype)makeWithColors:(NSArray *)colors + startPoints:(NSArray *)startPoints + colorMapSize:(NSInteger)colorMapSize { + FGMPlatformHeatmapGradient *pigeonResult = [[FGMPlatformHeatmapGradient alloc] init]; + pigeonResult.colors = colors; + pigeonResult.startPoints = startPoints; + pigeonResult.colorMapSize = colorMapSize; + return pigeonResult; +} ++ (FGMPlatformHeatmapGradient *)fromList:(NSArray *)list { + FGMPlatformHeatmapGradient *pigeonResult = [[FGMPlatformHeatmapGradient alloc] init]; + pigeonResult.colors = GetNullableObjectAtIndex(list, 0); + pigeonResult.startPoints = GetNullableObjectAtIndex(list, 1); + pigeonResult.colorMapSize = [GetNullableObjectAtIndex(list, 2) integerValue]; + return pigeonResult; +} ++ (nullable FGMPlatformHeatmapGradient *)nullableFromList:(NSArray *)list { + return (list) ? [FGMPlatformHeatmapGradient fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + self.colors ?: [NSNull null], + self.startPoints ?: [NSNull null], + @(self.colorMapSize), + ]; +} +@end + +@implementation FGMPlatformWeightedLatLng ++ (instancetype)makeWithPoint:(FGMPlatformLatLng *)point weight:(double)weight { + FGMPlatformWeightedLatLng *pigeonResult = [[FGMPlatformWeightedLatLng alloc] init]; + pigeonResult.point = point; + pigeonResult.weight = weight; + return pigeonResult; +} ++ (FGMPlatformWeightedLatLng *)fromList:(NSArray *)list { + FGMPlatformWeightedLatLng *pigeonResult = [[FGMPlatformWeightedLatLng alloc] init]; + pigeonResult.point = GetNullableObjectAtIndex(list, 0); + pigeonResult.weight = [GetNullableObjectAtIndex(list, 1) doubleValue]; + return pigeonResult; +} ++ (nullable FGMPlatformWeightedLatLng *)nullableFromList:(NSArray *)list { + return (list) ? [FGMPlatformWeightedLatLng fromList:list] : nil; +} +- (NSArray *)toList { + return @[ + self.point ?: [NSNull null], + @(self.weight), ]; } @end @@ -1694,60 +1783,64 @@ - (nullable id)readValueOfType:(UInt8)type { case 144: return [FGMPlatformHeatmap fromList:[self readValue]]; case 145: - return [FGMPlatformInfoWindow fromList:[self readValue]]; + return [FGMPlatformHeatmapGradient fromList:[self readValue]]; case 146: - return [FGMPlatformCluster fromList:[self readValue]]; + return [FGMPlatformWeightedLatLng fromList:[self readValue]]; case 147: - return [FGMPlatformClusterManager fromList:[self readValue]]; + return [FGMPlatformInfoWindow fromList:[self readValue]]; case 148: - return [FGMPlatformMarker fromList:[self readValue]]; + return [FGMPlatformCluster fromList:[self readValue]]; case 149: - return [FGMPlatformPolygon fromList:[self readValue]]; + return [FGMPlatformClusterManager fromList:[self readValue]]; case 150: - return [FGMPlatformPolyline fromList:[self readValue]]; + return [FGMPlatformMarker fromList:[self readValue]]; case 151: - return [FGMPlatformPatternItem fromList:[self readValue]]; + return [FGMPlatformPolygon fromList:[self readValue]]; case 152: - return [FGMPlatformTile fromList:[self readValue]]; + return [FGMPlatformPolyline fromList:[self readValue]]; case 153: - return [FGMPlatformTileOverlay fromList:[self readValue]]; + return [FGMPlatformPatternItem fromList:[self readValue]]; case 154: - return [FGMPlatformEdgeInsets fromList:[self readValue]]; + return [FGMPlatformTile fromList:[self readValue]]; case 155: - return [FGMPlatformLatLng fromList:[self readValue]]; + return [FGMPlatformTileOverlay fromList:[self readValue]]; case 156: - return [FGMPlatformLatLngBounds fromList:[self readValue]]; + return [FGMPlatformEdgeInsets fromList:[self readValue]]; case 157: - return [FGMPlatformCameraTargetBounds fromList:[self readValue]]; + return [FGMPlatformLatLng fromList:[self readValue]]; case 158: - return [FGMPlatformGroundOverlay fromList:[self readValue]]; + return [FGMPlatformLatLngBounds fromList:[self readValue]]; case 159: - return [FGMPlatformMapViewCreationParams fromList:[self readValue]]; + return [FGMPlatformCameraTargetBounds fromList:[self readValue]]; case 160: - return [FGMPlatformMapConfiguration fromList:[self readValue]]; + return [FGMPlatformGroundOverlay fromList:[self readValue]]; case 161: - return [FGMPlatformPoint fromList:[self readValue]]; + return [FGMPlatformMapViewCreationParams fromList:[self readValue]]; case 162: - return [FGMPlatformSize fromList:[self readValue]]; + return [FGMPlatformMapConfiguration fromList:[self readValue]]; case 163: - return [FGMPlatformColor fromList:[self readValue]]; + return [FGMPlatformPoint fromList:[self readValue]]; case 164: - return [FGMPlatformTileLayer fromList:[self readValue]]; + return [FGMPlatformSize fromList:[self readValue]]; case 165: - return [FGMPlatformZoomRange fromList:[self readValue]]; + return [FGMPlatformColor fromList:[self readValue]]; case 166: - return [FGMPlatformBitmap fromList:[self readValue]]; + return [FGMPlatformTileLayer fromList:[self readValue]]; case 167: - return [FGMPlatformBitmapDefaultMarker fromList:[self readValue]]; + return [FGMPlatformZoomRange fromList:[self readValue]]; case 168: - return [FGMPlatformBitmapBytes fromList:[self readValue]]; + return [FGMPlatformBitmap fromList:[self readValue]]; case 169: - return [FGMPlatformBitmapAsset fromList:[self readValue]]; + return [FGMPlatformBitmapDefaultMarker fromList:[self readValue]]; case 170: - return [FGMPlatformBitmapAssetImage fromList:[self readValue]]; + return [FGMPlatformBitmapBytes fromList:[self readValue]]; case 171: - return [FGMPlatformBitmapAssetMap fromList:[self readValue]]; + return [FGMPlatformBitmapAsset fromList:[self readValue]]; case 172: + return [FGMPlatformBitmapAssetImage fromList:[self readValue]]; + case 173: + return [FGMPlatformBitmapAssetMap fromList:[self readValue]]; + case 174: return [FGMPlatformBitmapBytesMap fromList:[self readValue]]; default: return [super readValueOfType:type]; @@ -1811,90 +1904,96 @@ - (void)writeValue:(id)value { } else if ([value isKindOfClass:[FGMPlatformHeatmap class]]) { [self writeByte:144]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformInfoWindow class]]) { + } else if ([value isKindOfClass:[FGMPlatformHeatmapGradient class]]) { [self writeByte:145]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformCluster class]]) { + } else if ([value isKindOfClass:[FGMPlatformWeightedLatLng class]]) { [self writeByte:146]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformClusterManager class]]) { + } else if ([value isKindOfClass:[FGMPlatformInfoWindow class]]) { [self writeByte:147]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformMarker class]]) { + } else if ([value isKindOfClass:[FGMPlatformCluster class]]) { [self writeByte:148]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformPolygon class]]) { + } else if ([value isKindOfClass:[FGMPlatformClusterManager class]]) { [self writeByte:149]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformPolyline class]]) { + } else if ([value isKindOfClass:[FGMPlatformMarker class]]) { [self writeByte:150]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformPatternItem class]]) { + } else if ([value isKindOfClass:[FGMPlatformPolygon class]]) { [self writeByte:151]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformTile class]]) { + } else if ([value isKindOfClass:[FGMPlatformPolyline class]]) { [self writeByte:152]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformTileOverlay class]]) { + } else if ([value isKindOfClass:[FGMPlatformPatternItem class]]) { [self writeByte:153]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformEdgeInsets class]]) { + } else if ([value isKindOfClass:[FGMPlatformTile class]]) { [self writeByte:154]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformLatLng class]]) { + } else if ([value isKindOfClass:[FGMPlatformTileOverlay class]]) { [self writeByte:155]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformLatLngBounds class]]) { + } else if ([value isKindOfClass:[FGMPlatformEdgeInsets class]]) { [self writeByte:156]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformCameraTargetBounds class]]) { + } else if ([value isKindOfClass:[FGMPlatformLatLng class]]) { [self writeByte:157]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformGroundOverlay class]]) { + } else if ([value isKindOfClass:[FGMPlatformLatLngBounds class]]) { [self writeByte:158]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformMapViewCreationParams class]]) { + } else if ([value isKindOfClass:[FGMPlatformCameraTargetBounds class]]) { [self writeByte:159]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformMapConfiguration class]]) { + } else if ([value isKindOfClass:[FGMPlatformGroundOverlay class]]) { [self writeByte:160]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformPoint class]]) { + } else if ([value isKindOfClass:[FGMPlatformMapViewCreationParams class]]) { [self writeByte:161]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformSize class]]) { + } else if ([value isKindOfClass:[FGMPlatformMapConfiguration class]]) { [self writeByte:162]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformColor class]]) { + } else if ([value isKindOfClass:[FGMPlatformPoint class]]) { [self writeByte:163]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) { + } else if ([value isKindOfClass:[FGMPlatformSize class]]) { [self writeByte:164]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) { + } else if ([value isKindOfClass:[FGMPlatformColor class]]) { [self writeByte:165]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmap class]]) { + } else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) { [self writeByte:166]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapDefaultMarker class]]) { + } else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) { [self writeByte:167]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapBytes class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmap class]]) { [self writeByte:168]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAsset class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapDefaultMarker class]]) { [self writeByte:169]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAssetImage class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapBytes class]]) { [self writeByte:170]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapAssetMap class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapAsset class]]) { [self writeByte:171]; [self writeValue:[value toList]]; - } else if ([value isKindOfClass:[FGMPlatformBitmapBytesMap class]]) { + } else if ([value isKindOfClass:[FGMPlatformBitmapAssetImage class]]) { [self writeByte:172]; [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FGMPlatformBitmapAssetMap class]]) { + [self writeByte:173]; + [self writeValue:[value toList]]; + } else if ([value isKindOfClass:[FGMPlatformBitmapBytesMap class]]) { + [self writeByte:174]; + [self writeValue:[value toList]]; } else { [super writeValue:value]; } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart index 9ab35fc6aae2..a0057b9fdc54 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_map_inspector_ios.dart @@ -8,7 +8,6 @@ import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf import 'google_maps_flutter_ios.dart'; import 'messages.g.dart'; -import 'serialization.dart'; /// An Android of implementation of [GoogleMapsInspectorPlatform]. @visibleForTesting @@ -95,19 +94,14 @@ class GoogleMapsInspectorIOS extends GoogleMapsInspectorPlatform { return null; } - final Map json = - (heatmapInfo.json as Map).cast(); return Heatmap( heatmapId: heatmapId, - data: (json['data']! as List) - .map(deserializeWeightedLatLng) - .whereType() - .toList(), - gradient: deserializeHeatmapGradient(json['gradient']), - opacity: json['opacity']! as double, - radius: HeatmapRadius.fromPixels(json['radius']! as int), - minimumZoomIntensity: json['minimumZoomIntensity']! as int, - maximumZoomIntensity: json['maximumZoomIntensity']! as int, + data: heatmapInfo.data.map(_deserializeWeightedLatLng).toList(), + gradient: _deserializeHeatmapGradient(heatmapInfo.gradient), + opacity: heatmapInfo.opacity, + radius: HeatmapRadius.fromPixels(heatmapInfo.radius), + minimumZoomIntensity: heatmapInfo.minimumZoomIntensity, + maximumZoomIntensity: heatmapInfo.maximumZoomIntensity, ); } @@ -236,4 +230,48 @@ class GoogleMapsInspectorIOS extends GoogleMapsInspectorPlatform { zoom: cameraPosition.zoom, ); } + + static HeatmapGradient? _deserializeHeatmapGradient( + PlatformHeatmapGradient? gradient, + ) { + if (gradient == null) { + return null; + } + return HeatmapGradient( + // Zip the colors and start points together, since they are parallel + // arrays on the platform side. + _mapEnumerated( + gradient.colors, + (PlatformColor color, int i) => HeatmapGradientColor( + Color.from( + red: color.red, + green: color.green, + blue: color.blue, + alpha: color.alpha, + ), + gradient.startPoints[i], + ), + ).toList(), + colorMapSize: gradient.colorMapSize, + ); + } + + static WeightedLatLng _deserializeWeightedLatLng( + PlatformWeightedLatLng weightedLatLng, + ) { + return WeightedLatLng( + LatLng(weightedLatLng.point.latitude, weightedLatLng.point.longitude), + weight: weightedLatLng.weight, + ); + } +} + +Iterable _mapEnumerated( + Iterable iterable, + E Function(T, int) fn, +) sync* { + var index = 0; + for (final item in iterable) { + yield fn(item, index++); + } } diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart index 87fae9a1507d..c7e469ad1491 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/google_maps_flutter_ios.dart @@ -13,7 +13,6 @@ import 'package:stream_transform/stream_transform.dart'; import 'google_map_inspector_ios.dart'; import 'messages.g.dart'; -import 'serialization.dart'; /// The non-test implementation of `_apiProvider`. MapsApi _productionApiProvider(int mapId) { @@ -673,7 +672,42 @@ class GoogleMapsFlutterIOS extends GoogleMapsFlutterPlatform { } static PlatformHeatmap _platformHeatmapFromHeatmap(Heatmap heatmap) { - return PlatformHeatmap(json: serializeHeatmap(heatmap)); + final HeatmapGradient? gradient = heatmap.gradient; + return PlatformHeatmap( + heatmapId: heatmap.heatmapId.value, + data: heatmap.data + .map(_platformWeightedLatLngFromWeightedLatLng) + .toList(), + gradient: _platformHeatmapGradientFromHeatmapGradient(gradient), + opacity: heatmap.opacity, + radius: heatmap.radius.radius, + minimumZoomIntensity: heatmap.minimumZoomIntensity, + maximumZoomIntensity: heatmap.maximumZoomIntensity, + ); + } + + static PlatformHeatmapGradient? _platformHeatmapGradientFromHeatmapGradient( + HeatmapGradient? gradient, + ) { + if (gradient == null) { + return null; + } + return PlatformHeatmapGradient( + colors: gradient.colors + .map( + (HeatmapGradientColor c) => PlatformColor( + red: c.color.r, + green: c.color.g, + blue: c.color.b, + alpha: c.color.a, + ), + ) + .toList(), + startPoints: gradient.colors + .map((HeatmapGradientColor c) => c.startPoint) + .toList(), + colorMapSize: gradient.colorMapSize, + ); } static PlatformInfoWindow _platformInfoWindowFromInfoWindow( @@ -1158,6 +1192,15 @@ PlatformLatLngBounds? _platformLatLngBoundsFromLatLngBounds( ); } +PlatformWeightedLatLng _platformWeightedLatLngFromWeightedLatLng( + WeightedLatLng weightedLatLng, +) { + return PlatformWeightedLatLng( + point: _platformLatLngFromLatLng(weightedLatLng.point), + weight: weightedLatLng.weight, + ); +} + PlatformCameraTargetBounds? _platformCameraTargetBoundsFromCameraTargetBounds( CameraTargetBounds? bounds, ) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart index 2bb8b3fb42d6..bd54d5f62322 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/messages.g.dart @@ -1,9 +1,9 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.0), do not edit directly. +// Autogenerated from Pigeon (v26.1.5), do not edit directly. // See also: https://pub.dev/packages/pigeon -// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers +// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; @@ -559,15 +559,40 @@ class PlatformCircle { /// Pigeon equivalent of the Heatmap class. class PlatformHeatmap { - PlatformHeatmap({required this.json}); + PlatformHeatmap({ + required this.heatmapId, + required this.data, + this.gradient, + required this.opacity, + required this.radius, + required this.minimumZoomIntensity, + required this.maximumZoomIntensity, + }); + + String heatmapId; + + List data; + + PlatformHeatmapGradient? gradient; + + double opacity; + + int radius; + + int minimumZoomIntensity; - /// The heatmap data, as JSON. This should only be set from - /// Heatmap.toJson, and the native code must interpret it according to the - /// internal implementation details of that method. - Object json; + int maximumZoomIntensity; List _toList() { - return [json]; + return [ + heatmapId, + data, + gradient, + opacity, + radius, + minimumZoomIntensity, + maximumZoomIntensity, + ]; } Object encode() { @@ -576,7 +601,15 @@ class PlatformHeatmap { static PlatformHeatmap decode(Object result) { result as List; - return PlatformHeatmap(json: result[0]!); + return PlatformHeatmap( + heatmapId: result[0]! as String, + data: (result[1] as List?)!.cast(), + gradient: result[2] as PlatformHeatmapGradient?, + opacity: result[3]! as double, + radius: result[4]! as int, + minimumZoomIntensity: result[5]! as int, + maximumZoomIntensity: result[6]! as int, + ); } @override @@ -596,6 +629,99 @@ class PlatformHeatmap { int get hashCode => Object.hashAll(_toList()); } +/// Pigeon equivalent of the HeatmapGradient class. +/// +/// The GMUGradient structure is slightly different from HeatmapGradient, so +/// this matches the iOS API so that conversion can be done on the Dart side +/// where the structures are easier to work with. +class PlatformHeatmapGradient { + PlatformHeatmapGradient({ + required this.colors, + required this.startPoints, + required this.colorMapSize, + }); + + List colors; + + List startPoints; + + int colorMapSize; + + List _toList() { + return [colors, startPoints, colorMapSize]; + } + + Object encode() { + return _toList(); + } + + static PlatformHeatmapGradient decode(Object result) { + result as List; + return PlatformHeatmapGradient( + colors: (result[0] as List?)!.cast(), + startPoints: (result[1] as List?)!.cast(), + colorMapSize: result[2]! as int, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformHeatmapGradient || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + +/// Pigeon equivalent of the WeightedLatLng class. +class PlatformWeightedLatLng { + PlatformWeightedLatLng({required this.point, required this.weight}); + + PlatformLatLng point; + + double weight; + + List _toList() { + return [point, weight]; + } + + Object encode() { + return _toList(); + } + + static PlatformWeightedLatLng decode(Object result) { + result as List; + return PlatformWeightedLatLng( + point: result[0]! as PlatformLatLng, + weight: result[1]! as double, + ); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + bool operator ==(Object other) { + if (other is! PlatformWeightedLatLng || other.runtimeType != runtimeType) { + return false; + } + if (identical(this, other)) { + return true; + } + return _deepEquals(encode(), other.encode()); + } + + @override + // ignore: avoid_equals_and_hash_code_on_mutable_classes + int get hashCode => Object.hashAll(_toList()); +} + /// Pigeon equivalent of the InfoWindow class. class PlatformInfoWindow { PlatformInfoWindow({this.title, this.snippet, required this.anchor}); @@ -2244,90 +2370,96 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is PlatformHeatmap) { buffer.putUint8(144); writeValue(buffer, value.encode()); - } else if (value is PlatformInfoWindow) { + } else if (value is PlatformHeatmapGradient) { buffer.putUint8(145); writeValue(buffer, value.encode()); - } else if (value is PlatformCluster) { + } else if (value is PlatformWeightedLatLng) { buffer.putUint8(146); writeValue(buffer, value.encode()); - } else if (value is PlatformClusterManager) { + } else if (value is PlatformInfoWindow) { buffer.putUint8(147); writeValue(buffer, value.encode()); - } else if (value is PlatformMarker) { + } else if (value is PlatformCluster) { buffer.putUint8(148); writeValue(buffer, value.encode()); - } else if (value is PlatformPolygon) { + } else if (value is PlatformClusterManager) { buffer.putUint8(149); writeValue(buffer, value.encode()); - } else if (value is PlatformPolyline) { + } else if (value is PlatformMarker) { buffer.putUint8(150); writeValue(buffer, value.encode()); - } else if (value is PlatformPatternItem) { + } else if (value is PlatformPolygon) { buffer.putUint8(151); writeValue(buffer, value.encode()); - } else if (value is PlatformTile) { + } else if (value is PlatformPolyline) { buffer.putUint8(152); writeValue(buffer, value.encode()); - } else if (value is PlatformTileOverlay) { + } else if (value is PlatformPatternItem) { buffer.putUint8(153); writeValue(buffer, value.encode()); - } else if (value is PlatformEdgeInsets) { + } else if (value is PlatformTile) { buffer.putUint8(154); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLng) { + } else if (value is PlatformTileOverlay) { buffer.putUint8(155); writeValue(buffer, value.encode()); - } else if (value is PlatformLatLngBounds) { + } else if (value is PlatformEdgeInsets) { buffer.putUint8(156); writeValue(buffer, value.encode()); - } else if (value is PlatformCameraTargetBounds) { + } else if (value is PlatformLatLng) { buffer.putUint8(157); writeValue(buffer, value.encode()); - } else if (value is PlatformGroundOverlay) { + } else if (value is PlatformLatLngBounds) { buffer.putUint8(158); writeValue(buffer, value.encode()); - } else if (value is PlatformMapViewCreationParams) { + } else if (value is PlatformCameraTargetBounds) { buffer.putUint8(159); writeValue(buffer, value.encode()); - } else if (value is PlatformMapConfiguration) { + } else if (value is PlatformGroundOverlay) { buffer.putUint8(160); writeValue(buffer, value.encode()); - } else if (value is PlatformPoint) { + } else if (value is PlatformMapViewCreationParams) { buffer.putUint8(161); writeValue(buffer, value.encode()); - } else if (value is PlatformSize) { + } else if (value is PlatformMapConfiguration) { buffer.putUint8(162); writeValue(buffer, value.encode()); - } else if (value is PlatformColor) { + } else if (value is PlatformPoint) { buffer.putUint8(163); writeValue(buffer, value.encode()); - } else if (value is PlatformTileLayer) { + } else if (value is PlatformSize) { buffer.putUint8(164); writeValue(buffer, value.encode()); - } else if (value is PlatformZoomRange) { + } else if (value is PlatformColor) { buffer.putUint8(165); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmap) { + } else if (value is PlatformTileLayer) { buffer.putUint8(166); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapDefaultMarker) { + } else if (value is PlatformZoomRange) { buffer.putUint8(167); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytes) { + } else if (value is PlatformBitmap) { buffer.putUint8(168); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAsset) { + } else if (value is PlatformBitmapDefaultMarker) { buffer.putUint8(169); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetImage) { + } else if (value is PlatformBitmapBytes) { buffer.putUint8(170); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapAssetMap) { + } else if (value is PlatformBitmapAsset) { buffer.putUint8(171); writeValue(buffer, value.encode()); - } else if (value is PlatformBitmapBytesMap) { + } else if (value is PlatformBitmapAssetImage) { buffer.putUint8(172); writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapAssetMap) { + buffer.putUint8(173); + writeValue(buffer, value.encode()); + } else if (value is PlatformBitmapBytesMap) { + buffer.putUint8(174); + writeValue(buffer, value.encode()); } else { super.writeValue(buffer, value); } @@ -2337,16 +2469,16 @@ class _PigeonCodec extends StandardMessageCodec { Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { case 129: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformMapType.values[value]; case 130: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformJointType.values[value]; case 131: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformPatternItemType.values[value]; case 132: - final int? value = readValue(buffer) as int?; + final value = readValue(buffer) as int?; return value == null ? null : PlatformMapBitmapScaling.values[value]; case 133: return PlatformCameraPosition.decode(readValue(buffer)!); @@ -2373,60 +2505,64 @@ class _PigeonCodec extends StandardMessageCodec { case 144: return PlatformHeatmap.decode(readValue(buffer)!); case 145: - return PlatformInfoWindow.decode(readValue(buffer)!); + return PlatformHeatmapGradient.decode(readValue(buffer)!); case 146: - return PlatformCluster.decode(readValue(buffer)!); + return PlatformWeightedLatLng.decode(readValue(buffer)!); case 147: - return PlatformClusterManager.decode(readValue(buffer)!); + return PlatformInfoWindow.decode(readValue(buffer)!); case 148: - return PlatformMarker.decode(readValue(buffer)!); + return PlatformCluster.decode(readValue(buffer)!); case 149: - return PlatformPolygon.decode(readValue(buffer)!); + return PlatformClusterManager.decode(readValue(buffer)!); case 150: - return PlatformPolyline.decode(readValue(buffer)!); + return PlatformMarker.decode(readValue(buffer)!); case 151: - return PlatformPatternItem.decode(readValue(buffer)!); + return PlatformPolygon.decode(readValue(buffer)!); case 152: - return PlatformTile.decode(readValue(buffer)!); + return PlatformPolyline.decode(readValue(buffer)!); case 153: - return PlatformTileOverlay.decode(readValue(buffer)!); + return PlatformPatternItem.decode(readValue(buffer)!); case 154: - return PlatformEdgeInsets.decode(readValue(buffer)!); + return PlatformTile.decode(readValue(buffer)!); case 155: - return PlatformLatLng.decode(readValue(buffer)!); + return PlatformTileOverlay.decode(readValue(buffer)!); case 156: - return PlatformLatLngBounds.decode(readValue(buffer)!); + return PlatformEdgeInsets.decode(readValue(buffer)!); case 157: - return PlatformCameraTargetBounds.decode(readValue(buffer)!); + return PlatformLatLng.decode(readValue(buffer)!); case 158: - return PlatformGroundOverlay.decode(readValue(buffer)!); + return PlatformLatLngBounds.decode(readValue(buffer)!); case 159: - return PlatformMapViewCreationParams.decode(readValue(buffer)!); + return PlatformCameraTargetBounds.decode(readValue(buffer)!); case 160: - return PlatformMapConfiguration.decode(readValue(buffer)!); + return PlatformGroundOverlay.decode(readValue(buffer)!); case 161: - return PlatformPoint.decode(readValue(buffer)!); + return PlatformMapViewCreationParams.decode(readValue(buffer)!); case 162: - return PlatformSize.decode(readValue(buffer)!); + return PlatformMapConfiguration.decode(readValue(buffer)!); case 163: - return PlatformColor.decode(readValue(buffer)!); + return PlatformPoint.decode(readValue(buffer)!); case 164: - return PlatformTileLayer.decode(readValue(buffer)!); + return PlatformSize.decode(readValue(buffer)!); case 165: - return PlatformZoomRange.decode(readValue(buffer)!); + return PlatformColor.decode(readValue(buffer)!); case 166: - return PlatformBitmap.decode(readValue(buffer)!); + return PlatformTileLayer.decode(readValue(buffer)!); case 167: - return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); + return PlatformZoomRange.decode(readValue(buffer)!); case 168: - return PlatformBitmapBytes.decode(readValue(buffer)!); + return PlatformBitmap.decode(readValue(buffer)!); case 169: - return PlatformBitmapAsset.decode(readValue(buffer)!); + return PlatformBitmapDefaultMarker.decode(readValue(buffer)!); case 170: - return PlatformBitmapAssetImage.decode(readValue(buffer)!); + return PlatformBitmapBytes.decode(readValue(buffer)!); case 171: - return PlatformBitmapAssetMap.decode(readValue(buffer)!); + return PlatformBitmapAsset.decode(readValue(buffer)!); case 172: + return PlatformBitmapAssetImage.decode(readValue(buffer)!); + case 173: + return PlatformBitmapAssetMap.decode(readValue(buffer)!); + case 174: return PlatformBitmapBytesMap.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2454,17 +2590,15 @@ class MapsApi { /// Returns once the map instance is available. Future waitForMap() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.waitForMap$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2485,19 +2619,17 @@ class MapsApi { Future updateMapConfiguration( PlatformMapConfiguration configuration, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateMapConfiguration$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [configuration], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2517,19 +2649,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateCircles$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2549,19 +2679,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateHeatmaps$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2580,19 +2708,17 @@ class MapsApi { List toAdd, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateClusterManagers$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2612,19 +2738,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateMarkers$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2644,19 +2768,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updatePolygons$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2676,19 +2798,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updatePolylines$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2708,19 +2828,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateTileOverlays$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2740,19 +2858,17 @@ class MapsApi { List toChange, List idsToRemove, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.updateGroundOverlays$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [toAdd, toChange, idsToRemove], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2768,19 +2884,17 @@ class MapsApi { /// Gets the screen coordinate for the given map location. Future getScreenCoordinate(PlatformLatLng latLng) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.getScreenCoordinate$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [latLng], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2801,19 +2915,17 @@ class MapsApi { /// Gets the map location for the given screen coordinate. Future getLatLng(PlatformPoint screenCoordinate) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.getLatLng$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [screenCoordinate], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2834,17 +2946,15 @@ class MapsApi { /// Gets the map region currently displayed on the map. Future getVisibleRegion() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.getVisibleRegion$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2866,19 +2976,17 @@ class MapsApi { /// Moves the camera according to [cameraUpdate] immediately, with no /// animation. Future moveCamera(PlatformCameraUpdate cameraUpdate) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.moveCamera$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [cameraUpdate], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2898,19 +3006,17 @@ class MapsApi { PlatformCameraUpdate cameraUpdate, int? durationMilliseconds, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.animateCamera$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [cameraUpdate, durationMilliseconds], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2926,17 +3032,15 @@ class MapsApi { /// Gets the current map zoom level. Future getZoomLevel() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.getZoomLevel$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2957,19 +3061,17 @@ class MapsApi { /// Show the info window for the marker with the given ID. Future showInfoWindow(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.showInfoWindow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -2985,19 +3087,17 @@ class MapsApi { /// Hide the info window for the marker with the given ID. Future hideInfoWindow(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.hideInfoWindow$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3014,19 +3114,17 @@ class MapsApi { /// Returns true if the marker with the given ID is currently displaying its /// info window. Future isInfoWindowShown(String markerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.isInfoWindowShown$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [markerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3051,19 +3149,17 @@ class MapsApi { /// If there was an error setting the style, such as an invalid style string, /// returns the error message. Future setStyle(String style) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.setStyle$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [style], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3083,17 +3179,15 @@ class MapsApi { /// This allows checking asynchronously for initial style failures, as there /// is no way to return failures from map initialization. Future getLastStyleError() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.getLastStyleError$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3109,19 +3203,17 @@ class MapsApi { /// Clears the cache of tiles previously requseted from the tile provider. Future clearTileCache(String tileOverlayId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.clearTileCache$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [tileOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3137,17 +3229,15 @@ class MapsApi { /// Takes a snapshot of the map and returns its image data. Future takeSnapshot() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsApi.takeSnapshot$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3227,8 +3317,7 @@ abstract class MapsCallbackApi { ? '.$messageChannelSuffix' : ''; { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onCameraMoveStarted$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3251,8 +3340,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onCameraMove$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3286,8 +3374,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onCameraIdle$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3310,8 +3397,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3344,8 +3430,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onLongPress$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3378,8 +3463,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onMarkerTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3412,8 +3496,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onMarkerDragStart$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3451,8 +3534,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onMarkerDrag$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3490,8 +3572,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onMarkerDragEnd$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3529,8 +3610,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onInfoWindowTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3563,8 +3643,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onCircleTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3597,8 +3676,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onClusterTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3631,8 +3709,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onPolygonTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3665,8 +3742,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onPolylineTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3699,8 +3775,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.onGroundOverlayTap$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3733,8 +3808,7 @@ abstract class MapsCallbackApi { } } { - final BasicMessageChannel - pigeonVar_channel = BasicMessageChannel( + final pigeonVar_channel = BasicMessageChannel( 'dev.flutter.pigeon.google_maps_flutter_ios.MapsCallbackApi.getTileOverlayTile$messageChannelSuffix', pigeonChannelCodec, binaryMessenger: binaryMessenger, @@ -3804,19 +3878,17 @@ class MapsPlatformViewApi { final String pigeonVar_messageChannelSuffix; Future createView(PlatformMapViewCreationParams? type) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsPlatformViewApi.createView$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [type], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3850,17 +3922,15 @@ class MapsInspectorApi { final String pigeonVar_messageChannelSuffix; Future areBuildingsEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.areBuildingsEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3880,17 +3950,15 @@ class MapsInspectorApi { } Future areRotateGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.areRotateGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3910,17 +3978,15 @@ class MapsInspectorApi { } Future areScrollGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.areScrollGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3940,17 +4006,15 @@ class MapsInspectorApi { } Future areTiltGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.areTiltGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -3970,17 +4034,15 @@ class MapsInspectorApi { } Future areZoomGesturesEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.areZoomGesturesEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4000,17 +4062,15 @@ class MapsInspectorApi { } Future isCompassEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.isCompassEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4030,17 +4090,15 @@ class MapsInspectorApi { } Future isMyLocationButtonEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.isMyLocationButtonEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4060,17 +4118,15 @@ class MapsInspectorApi { } Future isTrafficEnabled() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.isTrafficEnabled$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4090,19 +4146,17 @@ class MapsInspectorApi { } Future getTileOverlayInfo(String tileOverlayId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getTileOverlayInfo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [tileOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4119,19 +4173,17 @@ class MapsInspectorApi { Future getGroundOverlayInfo( String groundOverlayId, ) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getGroundOverlayInfo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [groundOverlayId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4146,19 +4198,17 @@ class MapsInspectorApi { } Future getHeatmapInfo(String heatmapId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getHeatmapInfo$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [heatmapId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4173,17 +4223,15 @@ class MapsInspectorApi { } Future getZoomRange() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getZoomRange$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4203,19 +4251,17 @@ class MapsInspectorApi { } Future> getClusters(String clusterManagerId) async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getClusters$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send( [clusterManagerId], ); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { @@ -4236,17 +4282,15 @@ class MapsInspectorApi { } Future getCameraPosition() async { - final String pigeonVar_channelName = + final pigeonVar_channelName = 'dev.flutter.pigeon.google_maps_flutter_ios.MapsInspectorApi.getCameraPosition$pigeonVar_messageChannelSuffix'; - final BasicMessageChannel pigeonVar_channel = - BasicMessageChannel( - pigeonVar_channelName, - pigeonChannelCodec, - binaryMessenger: pigeonVar_binaryMessenger, - ); + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); - final List? pigeonVar_replyList = - await pigeonVar_sendFuture as List?; + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; if (pigeonVar_replyList == null) { throw _createConnectionError(pigeonVar_channelName); } else if (pigeonVar_replyList.length > 1) { diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart b/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart deleted file mode 100644 index 2e174a4a7524..000000000000 --- a/packages/google_maps_flutter/google_maps_flutter_ios/lib/src/serialization.dart +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import 'package:flutter/material.dart'; -import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart'; - -// These constants must match the corresponding constants in FGMConversionUtils.m -const String _heatmapIdKey = 'heatmapId'; -const String _heatmapDataKey = 'data'; -const String _heatmapGradientKey = 'gradient'; -const String _heatmapOpacityKey = 'opacity'; -const String _heatmapRadiusKey = 'radius'; -const String _heatmapMinimumZoomIntensityKey = 'minimumZoomIntensity'; -const String _heatmapMaximumZoomIntensityKey = 'maximumZoomIntensity'; -const String _heatmapGradientColorsKey = 'colors'; -const String _heatmapGradientStartPointsKey = 'startPoints'; -const String _heatmapGradientColorMapSizeKey = 'colorMapSize'; - -void _addIfNonNull(Map map, String fieldName, Object? value) { - if (value != null) { - map[fieldName] = value; - } -} - -/// Serialize [Heatmap] -Object serializeHeatmap(Heatmap heatmap) { - final json = {}; - - _addIfNonNull(json, _heatmapIdKey, heatmap.heatmapId.value); - _addIfNonNull( - json, - _heatmapDataKey, - heatmap.data.map(serializeWeightedLatLng).toList(), - ); - - final HeatmapGradient? gradient = heatmap.gradient; - if (gradient != null) { - _addIfNonNull( - json, - _heatmapGradientKey, - serializeHeatmapGradient(gradient), - ); - } - _addIfNonNull(json, _heatmapOpacityKey, heatmap.opacity); - _addIfNonNull(json, _heatmapRadiusKey, heatmap.radius.radius); - _addIfNonNull( - json, - _heatmapMinimumZoomIntensityKey, - heatmap.minimumZoomIntensity, - ); - _addIfNonNull( - json, - _heatmapMaximumZoomIntensityKey, - heatmap.maximumZoomIntensity, - ); - - return json; -} - -/// Serialize [WeightedLatLng] -Object serializeWeightedLatLng(WeightedLatLng wll) { - return [serializeLatLng(wll.point), wll.weight]; -} - -/// Deserialize [WeightedLatLng] -WeightedLatLng? deserializeWeightedLatLng(Object? json) { - if (json == null) { - return null; - } - assert(json is List && json.length == 2); - final list = json as List; - final LatLng latLng = deserializeLatLng(list[0])!; - return WeightedLatLng(latLng, weight: list[1] as double); -} - -/// Serialize [LatLng] -Object serializeLatLng(LatLng latLng) { - return [latLng.latitude, latLng.longitude]; -} - -/// Deserialize [LatLng] -LatLng? deserializeLatLng(Object? json) { - if (json == null) { - return null; - } - assert(json is List && json.length == 2); - final list = json as List; - return LatLng(list[0]! as double, list[1]! as double); -} - -/// Serialize [HeatmapGradient] -Object serializeHeatmapGradient(HeatmapGradient gradient) { - final json = {}; - - _addIfNonNull( - json, - _heatmapGradientColorsKey, - gradient.colors - .map((HeatmapGradientColor e) => e.color.toARGB32()) - .toList(), - ); - _addIfNonNull( - json, - _heatmapGradientStartPointsKey, - gradient.colors.map((HeatmapGradientColor e) => e.startPoint).toList(), - ); - _addIfNonNull(json, _heatmapGradientColorMapSizeKey, gradient.colorMapSize); - - return json; -} - -/// Deserialize [HeatmapGradient] -HeatmapGradient? deserializeHeatmapGradient(Object? json) { - if (json == null) { - return null; - } - assert(json is Map); - final Map map = (json as Map).cast(); - final List colors = (map[_heatmapGradientColorsKey]! as List) - .whereType() - .map((int e) => Color(e)) - .toList(); - final List startPoints = - (map[_heatmapGradientStartPointsKey]! as List) - .whereType() - .toList(); - final gradientColors = []; - for (var i = 0; i < colors.length; i++) { - gradientColors.add(HeatmapGradientColor(colors[i], startPoints[i])); - } - return HeatmapGradient( - gradientColors, - colorMapSize: map[_heatmapGradientColorMapSizeKey] as int? ?? 256, - ); -} diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart index 98af369be23a..b4bb2a6b8783 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pigeons/messages.dart @@ -123,14 +123,48 @@ class PlatformCircle { /// Pigeon equivalent of the Heatmap class. class PlatformHeatmap { - PlatformHeatmap(this.json); - - /// The heatmap data, as JSON. This should only be set from - /// Heatmap.toJson, and the native code must interpret it according to the - /// internal implementation details of that method. - // TODO(stuartmorgan): Replace this with structured data. This exists only to - // allow incremental migration to Pigeon. - final Object json; + PlatformHeatmap({ + required this.heatmapId, + required this.data, + this.gradient, + required this.opacity, + required this.radius, + required this.minimumZoomIntensity, + required this.maximumZoomIntensity, + }); + + final String heatmapId; + final List data; + final PlatformHeatmapGradient? gradient; + final double opacity; + final int radius; + final int minimumZoomIntensity; + final int maximumZoomIntensity; +} + +/// Pigeon equivalent of the HeatmapGradient class. +/// +/// The GMUGradient structure is slightly different from HeatmapGradient, so +/// this matches the iOS API so that conversion can be done on the Dart side +/// where the structures are easier to work with. +class PlatformHeatmapGradient { + PlatformHeatmapGradient({ + required this.colors, + required this.startPoints, + required this.colorMapSize, + }); + + final List colors; + final List startPoints; + final int colorMapSize; +} + +/// Pigeon equivalent of the WeightedLatLng class. +class PlatformWeightedLatLng { + PlatformWeightedLatLng({required this.point, required this.weight}); + + final PlatformLatLng point; + final double weight; } /// Pigeon equivalent of the InfoWindow class. diff --git a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml index ece48e093fa1..46b1196b559d 100644 --- a/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml +++ b/packages/google_maps_flutter/google_maps_flutter_ios/pubspec.yaml @@ -2,11 +2,11 @@ name: google_maps_flutter_ios description: iOS implementation of the google_maps_flutter plugin. repository: https://github.com/flutter/packages/tree/main/packages/google_maps_flutter/google_maps_flutter_ios issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+maps%22 -version: 2.16.0 +version: 2.16.1 environment: - sdk: ^3.8.0 - flutter: ">=3.32.0" + sdk: ^3.9.0 + flutter: ">=3.35.0" flutter: plugin: