Skip to content

Commit

Permalink
replace .dartify() by .toDart.map(.toDart).toList()
Browse files Browse the repository at this point in the history
  • Loading branch information
a14n committed Sep 27, 2024
1 parent 68d80d4 commit 80e6e60
Show file tree
Hide file tree
Showing 49 changed files with 108 additions and 181 deletions.
6 changes: 0 additions & 6 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

Most of the lib is generated from the [online documentation](https://developers.google.com/maps/documentation/javascript/reference).

There are 2 steps:

1. Generate template class from documentation
2. Generate real code with [js_wrapping_generator](https://pub.dev/packages/js_wrapping_generator)

```
dart tool/generate_lib.dart
dart run build_runner build --delete-conflicting-outputs -v lib
```
1 change: 1 addition & 0 deletions lib/google_maps_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ export 'src/generated/coordinates.dart';
export 'src/generated/directions.dart';
export 'src/generated/errors.dart';
export 'src/generated/event.dart';
export 'src/generated/map.dart';
export 'src/generated/marker.dart';
export 'src/generated/settings.dart';
25 changes: 18 additions & 7 deletions lib/src/generated/3d_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,30 @@ import 'coordinates.dart'
LatLngAltitude,
LatLngAltitudeLiteral,
LatLngBoundsOrLatLngBoundsLiteral,
LatLngLiteral;
LatLngLiteral,
Orientation3D,
Orientation3DLiteral,
Vector3D,
Vector3DLiteral;
import 'marker.dart' show CollisionBehavior;
import 'place.dart' show Place;

part '3d_map/altitude_mode.dart';
part '3d_map/center_change_event.dart';
part '3d_map/click_event.dart';
part '3d_map/heading_change_event.dart';
part '3d_map/camera_options.dart';
part '3d_map/fly_around_animation_options.dart';
part '3d_map/fly_to_animation_options.dart';
part '3d_map/location_click_event.dart';
part '3d_map/map_3_delement.dart';
part '3d_map/map_3_delement_options.dart';
part '3d_map/marker_3_delement.dart';
part '3d_map/marker_3_delement_options.dart';
part '3d_map/marker_3_dinteractive_element.dart';
part '3d_map/marker_3_dinteractive_element_options.dart';
part '3d_map/model_3_delement.dart';
part '3d_map/model_3_delement_options.dart';
part '3d_map/place_click_event.dart';
part '3d_map/polygon_3_delement.dart';
part '3d_map/polygon_3_delement_options.dart';
part '3d_map/polyline_3_delement.dart';
part '3d_map/polyline_3_delement_options.dart';
part '3d_map/range_change_event.dart';
part '3d_map/roll_change_event.dart';
part '3d_map/steady_change_event.dart';
part '3d_map/tilt_change_event.dart';
18 changes: 0 additions & 18 deletions lib/src/generated/3d_map/center_change_event.dart

This file was deleted.

20 changes: 0 additions & 20 deletions lib/src/generated/3d_map/click_event.dart

This file was deleted.

18 changes: 0 additions & 18 deletions lib/src/generated/3d_map/heading_change_event.dart

This file was deleted.

8 changes: 8 additions & 0 deletions lib/src/generated/3d_map/map_3_delement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extension type Map3DElement._(HTMLElement _)
external LatLngBoundsOrLatLngBoundsLiteral? bounds;
external JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center;
external bool? defaultLabelsDisabled;
external bool? defaultUIDisabled;
external num? heading;
external num? maxAltitude;
external num? maxHeading;
Expand All @@ -38,9 +39,16 @@ extension type Map3DElement._(HTMLElement _)
JSAny /*EventListener|EventListenerObject*/ listener, [
JSAny? /*(boolean|AddEventListenerOptions)?*/ options,
]);
external void flyCameraAround(
FlyAroundAnimationOptions options,
);
external void flyCameraTo(
FlyToAnimationOptions options,
);
external void removeEventListener(
String type,
JSAny /*EventListener|EventListenerObject*/ listener, [
JSAny? /*(boolean|EventListenerOptions)?*/ options,
]);
external void stopCameraAnimation();
}
2 changes: 2 additions & 0 deletions lib/src/generated/3d_map/map_3_delement_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extension type Map3DElementOptions._(JSObject _) implements JSObject {
LatLngBoundsOrLatLngBoundsLiteral? bounds,
JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center,
bool? defaultLabelsDisabled,
bool? defaultUIDisabled,
num? heading,
num? maxAltitude,
num? maxHeading,
Expand All @@ -33,6 +34,7 @@ extension type Map3DElementOptions._(JSObject _) implements JSObject {
external LatLngBoundsOrLatLngBoundsLiteral? bounds;
external JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center;
external bool? defaultLabelsDisabled;
external bool? defaultUIDisabled;
external num? heading;
external num? maxAltitude;
external num? maxHeading;
Expand Down
2 changes: 0 additions & 2 deletions lib/src/generated/3d_map/polygon_3_delement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ extension type Polygon3DElement._(HTMLElement _)
external bool? drawsOccludedSegments;
external bool? extruded;
external String? fillColor;
external num? fillOpacity;
external bool? geodesic;
external JSIterable<
JSIterable<
Expand All @@ -34,7 +33,6 @@ extension type Polygon3DElement._(HTMLElement _)
JSAny /*LatLngAltitude|LatLngAltitudeLiteral|LatLngLiteral*/ >?
outerCoordinates;
external String? strokeColor;
external num? strokeOpacity;
external num? strokeWidth;
external num? zIndex;
external void addEventListener(
Expand Down
4 changes: 0 additions & 4 deletions lib/src/generated/3d_map/polygon_3_delement_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,20 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject {
bool? drawsOccludedSegments,
bool? extruded,
String? fillColor,
num? fillOpacity,
bool? geodesic,
JSIterable<
JSAny /*Iterable<LatLngAltitude|LatLngAltitudeLiteral>|Iterable<LatLngLiteral>*/ >?
innerCoordinates,
JSIterable<JSAny /*LatLngAltitude|LatLngAltitudeLiteral|LatLngLiteral*/ >?
outerCoordinates,
String? strokeColor,
num? strokeOpacity,
num? strokeWidth,
num? zIndex,
});
external AltitudeMode? altitudeMode;
external bool? drawsOccludedSegments;
external bool? extruded;
external String? fillColor;
external num? fillOpacity;
external bool? geodesic;
external JSIterable<
JSAny /*Iterable<LatLngAltitude|LatLngAltitudeLiteral>|Iterable<LatLngLiteral>*/ >?
Expand All @@ -45,7 +42,6 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject {
JSAny /*LatLngAltitude|LatLngAltitudeLiteral|LatLngLiteral*/ >?
outerCoordinates;
external String? strokeColor;
external num? strokeOpacity;
external num? strokeWidth;
external num? zIndex;
}
2 changes: 0 additions & 2 deletions lib/src/generated/3d_map/polyline_3_delement.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ extension type Polyline3DElement._(HTMLElement _)
external bool? extruded;
external bool? geodesic;
external String? outerColor;
external num? outerOpacity;
external num? outerWidth;
external String? strokeColor;
external num? strokeOpacity;
external num? strokeWidth;
external num? zIndex;
external void addEventListener(
Expand Down
4 changes: 0 additions & 4 deletions lib/src/generated/3d_map/polyline_3_delement_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ extension type Polyline3DElementOptions._(JSObject _) implements JSObject {
bool? extruded,
bool? geodesic,
String? outerColor,
num? outerOpacity,
num? outerWidth,
String? strokeColor,
num? strokeOpacity,
num? strokeWidth,
num? zIndex,
});
Expand All @@ -38,10 +36,8 @@ extension type Polyline3DElementOptions._(JSObject _) implements JSObject {
external bool? extruded;
external bool? geodesic;
external String? outerColor;
external num? outerOpacity;
external num? outerWidth;
external String? strokeColor;
external num? strokeOpacity;
external num? strokeWidth;
external num? zIndex;
}
18 changes: 0 additions & 18 deletions lib/src/generated/3d_map/range_change_event.dart

This file was deleted.

18 changes: 0 additions & 18 deletions lib/src/generated/3d_map/roll_change_event.dart

This file was deleted.

18 changes: 0 additions & 18 deletions lib/src/generated/3d_map/tilt_change_event.dart

This file was deleted.

4 changes: 2 additions & 2 deletions lib/src/generated/autocomplete_data/autocomplete_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ extension type AutocompleteRequest._(JSObject _) implements JSObject {
@JS('includedPrimaryTypes')
external JSArray<JSString>? _includedPrimaryTypes;
List<String>? get includedPrimaryTypes =>
_includedPrimaryTypes.dartify() as List<String>?;
_includedPrimaryTypes?.toDart.map((type) => type.toDart).toList();
set includedPrimaryTypes(List<String>? value) =>
_includedPrimaryTypes = value.jsify() as JSArray<JSString>?;
@JS('includedRegionCodes')
external JSArray<JSString>? _includedRegionCodes;
List<String>? get includedRegionCodes =>
_includedRegionCodes.dartify() as List<String>?;
_includedRegionCodes?.toDart.map((type) => type.toDart).toList();
set includedRegionCodes(List<String>? value) =>
_includedRegionCodes = value.jsify() as JSArray<JSString>?;
external num? inputOffset;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/generated/autocomplete_data/place_prediction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension type PlacePrediction._(JSObject _) implements JSObject {
external FormattableText text;
@JS('types')
external JSArray<JSString> _types;
List<String> get types => _types.dartify() as List<String>;
List<String> get types => _types.toDart.map((type) => type.toDart).toList();
set types(List<String> value) => _types = value.jsify() as JSArray<JSString>;
external Place toPlace();
}
1 change: 1 addition & 0 deletions lib/src/generated/control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import 'dart:js_interop';
import '/src/js/iterable.dart' show JSIterable;
import 'street_view_service.dart' show StreetViewSource;
part 'control/camera_control_options.dart';
part 'control/control_position.dart';
part 'control/fullscreen_control_options.dart';
part 'control/map_type_control_options.dart';
Expand Down
4 changes: 4 additions & 0 deletions lib/src/generated/coordinates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ part 'coordinates/lat_lng_altitude_literal.dart';
part 'coordinates/lat_lng_bounds.dart';
part 'coordinates/lat_lng_bounds_literal.dart';
part 'coordinates/lat_lng_literal.dart';
part 'coordinates/orientation_3.dart';
part 'coordinates/orientation_3_dliteral.dart';
part 'coordinates/padding.dart';
part 'coordinates/point.dart';
part 'coordinates/size.dart';
part 'coordinates/vector_3.dart';
part 'coordinates/vector_3_dliteral.dart';
3 changes: 2 additions & 1 deletion lib/src/generated/data/data_data_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ extension type DataDataOptions._(JSObject _) implements JSObject {
external ControlPosition? controlPosition;
@JS('controls')
external JSArray<JSString>? _controls;
List<String>? get controls => _controls.dartify() as List<String>?;
List<String>? get controls =>
_controls?.toDart.map((type) => type.toDart).toList();
set controls(List<String>? value) =>
_controls = value.jsify() as JSArray<JSString>?;
external String? drawingMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension type DirectionsGeocodedWaypoint._(JSObject _) implements JSObject {
set placeId(String? value) => _placeId = value;
@JS('types')
external JSArray<JSString>? _types;
List<String>? get types => _types.dartify() as List<String>?;
List<String>? get types => _types?.toDart.map((type) => type.toDart).toList();
set types(List<String>? value) =>
_types = value.jsify() as JSArray<JSString>?;
}
6 changes: 4 additions & 2 deletions lib/src/generated/directions/directions_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ extension type DirectionsRoute._(JSObject _) implements JSObject {
external String summary;
@JS('warnings')
external JSArray<JSString> _warnings;
List<String> get warnings => _warnings.dartify() as List<String>;
List<String> get warnings =>
_warnings.toDart.map((type) => type.toDart).toList();
set warnings(List<String> value) =>
_warnings = value.jsify() as JSArray<JSString>;
@JS('waypoint_order')
external JSArray<JSNumber> _waypointOrder;
List<num> get waypointOrder => _waypointOrder.dartify() as List<num>;
List<num> get waypointOrder =>
_waypointOrder.toDart.map((type) => type.toDartInt).toList();
set waypointOrder(List<num> value) =>
_waypointOrder = value.jsify() as JSArray<JSNumber>;
external TransitFare? fare;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ extension type DistanceMatrixResponse._(JSObject _) implements JSObject {
@JS('destinationAddresses')
external JSArray<JSString> _destinationAddresses;
List<String> get destinationAddresses =>
_destinationAddresses.dartify() as List<String>;
_destinationAddresses.toDart.map((type) => type.toDart).toList();
set destinationAddresses(List<String> value) =>
_destinationAddresses = value.jsify() as JSArray<JSString>;
@JS('originAddresses')
external JSArray<JSString> _originAddresses;
List<String> get originAddresses =>
_originAddresses.dartify() as List<String>;
_originAddresses.toDart.map((type) => type.toDart).toList();
set originAddresses(List<String> value) =>
_originAddresses = value.jsify() as JSArray<JSString>;
@JS('rows')
Expand Down
Loading

0 comments on commit 80e6e60

Please sign in to comment.