Skip to content

Commit

Permalink
[google_maps_flutter] Update iOS Pigeon for non-nullable generics (#7792
Browse files Browse the repository at this point in the history
)

Updates the Pigeon definition to uses non-nullable generics now that it's possible. Allows removing a force-unwrap now that the correct type is expressed in the definition.

Part of flutter/flutter#155891
  • Loading branch information
stuartmorgan authored Oct 12, 2024
1 parent 0da80be commit 53a0563
Show file tree
Hide file tree
Showing 8 changed files with 839 additions and 835 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.13.1

* Updates Pigeon for non-nullable collection type support.

## 2.13.0

* Updates map configuration and platform view creation parameters to use Pigeon.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v20.0.2), do not edit directly.
// Autogenerated from Pigeon (v22.4.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import <Foundation/Foundation.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v20.0.2), do not edit directly.
// Autogenerated from Pigeon (v22.4.2), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#import "messages.g.h"
Expand Down Expand Up @@ -761,52 +761,52 @@ @interface FGMMessagesPigeonCodecReader : FlutterStandardReader
@implementation FGMMessagesPigeonCodecReader
- (nullable id)readValueOfType:(UInt8)type {
switch (type) {
case 129:
return [FGMPlatformCameraPosition fromList:[self readValue]];
case 129: {
NSNumber *enumAsNumber = [self readValue];
return enumAsNumber == nil
? nil
: [[FGMPlatformMapTypeBox alloc] initWithValue:[enumAsNumber integerValue]];
}
case 130:
return [FGMPlatformCameraUpdate fromList:[self readValue]];
return [FGMPlatformCameraPosition fromList:[self readValue]];
case 131:
return [FGMPlatformCircle fromList:[self readValue]];
return [FGMPlatformCameraUpdate fromList:[self readValue]];
case 132:
return [FGMPlatformHeatmap fromList:[self readValue]];
return [FGMPlatformCircle fromList:[self readValue]];
case 133:
return [FGMPlatformCluster fromList:[self readValue]];
return [FGMPlatformHeatmap fromList:[self readValue]];
case 134:
return [FGMPlatformClusterManager fromList:[self readValue]];
return [FGMPlatformCluster fromList:[self readValue]];
case 135:
return [FGMPlatformMarker fromList:[self readValue]];
return [FGMPlatformClusterManager fromList:[self readValue]];
case 136:
return [FGMPlatformPolygon fromList:[self readValue]];
return [FGMPlatformMarker fromList:[self readValue]];
case 137:
return [FGMPlatformPolyline fromList:[self readValue]];
return [FGMPlatformPolygon fromList:[self readValue]];
case 138:
return [FGMPlatformTile fromList:[self readValue]];
return [FGMPlatformPolyline fromList:[self readValue]];
case 139:
return [FGMPlatformTileOverlay fromList:[self readValue]];
return [FGMPlatformTile fromList:[self readValue]];
case 140:
return [FGMPlatformEdgeInsets fromList:[self readValue]];
return [FGMPlatformTileOverlay fromList:[self readValue]];
case 141:
return [FGMPlatformLatLng fromList:[self readValue]];
return [FGMPlatformEdgeInsets fromList:[self readValue]];
case 142:
return [FGMPlatformLatLngBounds fromList:[self readValue]];
return [FGMPlatformLatLng fromList:[self readValue]];
case 143:
return [FGMPlatformCameraTargetBounds fromList:[self readValue]];
return [FGMPlatformLatLngBounds fromList:[self readValue]];
case 144:
return [FGMPlatformMapViewCreationParams fromList:[self readValue]];
return [FGMPlatformCameraTargetBounds fromList:[self readValue]];
case 145:
return [FGMPlatformMapConfiguration fromList:[self readValue]];
return [FGMPlatformMapViewCreationParams fromList:[self readValue]];
case 146:
return [FGMPlatformPoint fromList:[self readValue]];
return [FGMPlatformMapConfiguration fromList:[self readValue]];
case 147:
return [FGMPlatformTileLayer fromList:[self readValue]];
return [FGMPlatformPoint fromList:[self readValue]];
case 148:
return [FGMPlatformTileLayer fromList:[self readValue]];
case 149:
return [FGMPlatformZoomRange fromList:[self readValue]];
case 149: {
NSNumber *enumAsNumber = [self readValue];
return enumAsNumber == nil
? nil
: [[FGMPlatformMapTypeBox alloc] initWithValue:[enumAsNumber integerValue]];
}
default:
return [super readValueOfType:type];
}
Expand All @@ -817,70 +817,70 @@ @interface FGMMessagesPigeonCodecWriter : FlutterStandardWriter
@end
@implementation FGMMessagesPigeonCodecWriter
- (void)writeValue:(id)value {
if ([value isKindOfClass:[FGMPlatformCameraPosition class]]) {
if ([value isKindOfClass:[FGMPlatformMapTypeBox class]]) {
FGMPlatformMapTypeBox *box = (FGMPlatformMapTypeBox *)value;
[self writeByte:129];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformCameraUpdate class]]) {
[self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])];
} else if ([value isKindOfClass:[FGMPlatformCameraPosition class]]) {
[self writeByte:130];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformCircle class]]) {
} else if ([value isKindOfClass:[FGMPlatformCameraUpdate class]]) {
[self writeByte:131];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformHeatmap class]]) {
} else if ([value isKindOfClass:[FGMPlatformCircle class]]) {
[self writeByte:132];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformCluster class]]) {
} else if ([value isKindOfClass:[FGMPlatformHeatmap class]]) {
[self writeByte:133];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformClusterManager class]]) {
} else if ([value isKindOfClass:[FGMPlatformCluster class]]) {
[self writeByte:134];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformMarker class]]) {
} else if ([value isKindOfClass:[FGMPlatformClusterManager class]]) {
[self writeByte:135];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformPolygon class]]) {
} else if ([value isKindOfClass:[FGMPlatformMarker class]]) {
[self writeByte:136];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformPolyline class]]) {
} else if ([value isKindOfClass:[FGMPlatformPolygon class]]) {
[self writeByte:137];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformTile class]]) {
} else if ([value isKindOfClass:[FGMPlatformPolyline class]]) {
[self writeByte:138];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformTileOverlay class]]) {
} else if ([value isKindOfClass:[FGMPlatformTile class]]) {
[self writeByte:139];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformEdgeInsets class]]) {
} else if ([value isKindOfClass:[FGMPlatformTileOverlay class]]) {
[self writeByte:140];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformLatLng class]]) {
} else if ([value isKindOfClass:[FGMPlatformEdgeInsets class]]) {
[self writeByte:141];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformLatLngBounds class]]) {
} else if ([value isKindOfClass:[FGMPlatformLatLng class]]) {
[self writeByte:142];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformCameraTargetBounds class]]) {
} else if ([value isKindOfClass:[FGMPlatformLatLngBounds class]]) {
[self writeByte:143];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformMapViewCreationParams class]]) {
} else if ([value isKindOfClass:[FGMPlatformCameraTargetBounds class]]) {
[self writeByte:144];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformMapConfiguration class]]) {
} else if ([value isKindOfClass:[FGMPlatformMapViewCreationParams class]]) {
[self writeByte:145];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformPoint class]]) {
} else if ([value isKindOfClass:[FGMPlatformMapConfiguration class]]) {
[self writeByte:146];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) {
} else if ([value isKindOfClass:[FGMPlatformPoint class]]) {
[self writeByte:147];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) {
} else if ([value isKindOfClass:[FGMPlatformTileLayer class]]) {
[self writeByte:148];
[self writeValue:[value toList]];
} else if ([value isKindOfClass:[FGMPlatformMapTypeBox class]]) {
FGMPlatformMapTypeBox *box = (FGMPlatformMapTypeBox *)value;
} else if ([value isKindOfClass:[FGMPlatformZoomRange class]]) {
[self writeByte:149];
[self writeValue:(value == nil ? [NSNull null] : [NSNumber numberWithInteger:box.value])];
[self writeValue:[value toList]];
} else {
[super writeValue:value];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ class GoogleMapsInspectorIOS extends GoogleMapsInspectorPlatform {
}) async {
return (await _inspectorProvider(mapId)!
.getClusters(clusterManagerId.value))
// See comment in messages.dart for why the force unwrap is okay.
.map((PlatformCluster? cluster) =>
GoogleMapsFlutterIOS.clusterFromPlatformCluster(cluster!))
.map((PlatformCluster cluster) =>
GoogleMapsFlutterIOS.clusterFromPlatformCluster(cluster))
.toList();
}
}
Loading

0 comments on commit 53a0563

Please sign in to comment.