Skip to content

Commit

Permalink
dart format .
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Sep 13, 2024
1 parent d00e4c8 commit 3e8d488
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 63 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ welcome.
flutter pub global activate pigeon # only once
dart run pigeon --input pigeons/pigeon.dart
cp ios/Classes/Pigeon.g.swift macos/Classes/Pigeon.g.swift
dart format .
```

#### Test with WebAssembly
Expand Down
186 changes: 123 additions & 63 deletions lib/src/native/pigeon.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ PlatformException _createConnectionError(String channelName) {
);
}

List<Object?> wrapResponse({Object? result, PlatformException? error, bool empty = false}) {
List<Object?> wrapResponse(
{Object? result, PlatformException? error, bool empty = false}) {
if (empty) {
return <Object?>[];
}
Expand Down Expand Up @@ -142,21 +143,20 @@ class ScreenLocation {
}
}


class _PigeonCodec extends StandardMessageCodec {
const _PigeonCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
if (value is int) {
buffer.putUint8(4);
buffer.putInt64(value);
} else if (value is MapOptions) {
} else if (value is MapOptions) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is LngLat) {
} else if (value is LngLat) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else if (value is ScreenLocation) {
} else if (value is ScreenLocation) {
buffer.putUint8(131);
writeValue(buffer, value.encode());
} else {
Expand All @@ -167,11 +167,11 @@ class _PigeonCodec extends StandardMessageCodec {
@override
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 129:
case 129:
return MapOptions.decode(readValue(buffer)!);
case 130:
case 130:
return LngLat.decode(readValue(buffer)!);
case 131:
case 131:
return ScreenLocation.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
Expand All @@ -183,25 +183,34 @@ class MapLibreHostApi {
/// Constructor for [MapLibreHostApi]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
MapLibreHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
MapLibreHostApi(
{BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
pigeonVar_messageChannelSuffix =
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
final BinaryMessenger? pigeonVar_binaryMessenger;

static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();

final String pigeonVar_messageChannelSuffix;

/// Move the viewport of the map to a new location without any animation.
Future<void> jumpTo({required LngLat? center, required double? zoom, required double? bearing, required double? pitch,}) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
Future<void> jumpTo({
required LngLat? center,
required double? zoom,
required double? bearing,
required double? pitch,
}) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.jumpTo$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_channel.send(<Object?>[center, zoom, bearing, pitch]) as List<Object?>?;
final List<Object?>? pigeonVar_replyList = await pigeonVar_channel
.send(<Object?>[center, zoom, bearing, pitch]) as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
Expand All @@ -216,15 +225,24 @@ class MapLibreHostApi {
}

/// Animate the viewport of the map to a new location.
Future<void> flyTo({required LngLat? center, required double? zoom, required double? bearing, required double? pitch, required int durationMs,}) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
Future<void> flyTo({
required LngLat? center,
required double? zoom,
required double? bearing,
required double? pitch,
required int durationMs,
}) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.flyTo$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_channel.send(<Object?>[center, zoom, bearing, pitch, durationMs]) as List<Object?>?;
final List<Object?>? pigeonVar_replyList = await pigeonVar_channel
.send(<Object?>[center, zoom, bearing, pitch, durationMs])
as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
Expand All @@ -240,8 +258,10 @@ class MapLibreHostApi {

/// Convert a coordinate to a location on the screen.
Future<ScreenLocation> toScreenLocation(double lng, double lat) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.toScreenLocation$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand All @@ -268,8 +288,10 @@ class MapLibreHostApi {

/// Convert a screen location to a coordinate.
Future<LngLat> toLngLat(double x, double y) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.toLngLat$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand All @@ -295,9 +317,12 @@ class MapLibreHostApi {
}

/// Add a fill layer to the map style.
Future<void> addFillLayer({required String id, required String sourceId}) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
Future<void> addFillLayer(
{required String id, required String sourceId}) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.addFillLayer$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand All @@ -318,9 +343,12 @@ class MapLibreHostApi {
}

/// Add a circle layer to the map style.
Future<void> addCircleLayer({required String id, required String sourceId}) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
Future<void> addCircleLayer(
{required String id, required String sourceId}) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.addCircleLayer$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand All @@ -341,9 +369,12 @@ class MapLibreHostApi {
}

/// Add a GeoJSON source to the map style.
Future<void> addGeoJsonSource({required String id, required String data}) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
Future<void> addGeoJsonSource(
{required String id, required String data}) async {
final String pigeonVar_channelName =
'dev.flutter.pigeon.maplibre.MapLibreHostApi.addGeoJsonSource$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel =
BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
Expand Down Expand Up @@ -386,11 +417,19 @@ abstract class MapLibreFlutterApi {
/// Callback when the user performs a long lasting click on the map.
void onLongClick(LngLat point);

static void setUp(MapLibreFlutterApi? api, {BinaryMessenger? binaryMessenger, String messageChannelSuffix = '',}) {
messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
static void setUp(
MapLibreFlutterApi? api, {
BinaryMessenger? binaryMessenger,
String messageChannelSuffix = '',
}) {
messageChannelSuffix =
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.getOptions$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
Expand All @@ -401,15 +440,19 @@ abstract class MapLibreFlutterApi {
return wrapResponse(result: output);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onStyleLoaded$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
Expand All @@ -420,22 +463,26 @@ abstract class MapLibreFlutterApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null.');
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onClick was null.');
final List<Object?> args = (message as List<Object?>?)!;
final LngLat? arg_point = (args[0] as LngLat?);
assert(arg_point != null,
Expand All @@ -445,22 +492,26 @@ abstract class MapLibreFlutterApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null.');
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onSecondaryClick was null.');
final List<Object?> args = (message as List<Object?>?)!;
final LngLat? arg_point = (args[0] as LngLat?);
assert(arg_point != null,
Expand All @@ -470,22 +521,26 @@ abstract class MapLibreFlutterApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null.');
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onDoubleClick was null.');
final List<Object?> args = (message as List<Object?>?)!;
final LngLat? arg_point = (args[0] as LngLat?);
assert(arg_point != null,
Expand All @@ -495,22 +550,26 @@ abstract class MapLibreFlutterApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
}
{
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$messageChannelSuffix', pigeonChannelCodec,
final BasicMessageChannel<
Object?> pigeonVar_channel = BasicMessageChannel<
Object?>(
'dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick$messageChannelSuffix',
pigeonChannelCodec,
binaryMessenger: binaryMessenger);
if (api == null) {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null.');
'Argument for dev.flutter.pigeon.maplibre.MapLibreFlutterApi.onLongClick was null.');
final List<Object?> args = (message as List<Object?>?)!;
final LngLat? arg_point = (args[0] as LngLat?);
assert(arg_point != null,
Expand All @@ -520,8 +579,9 @@ abstract class MapLibreFlutterApi {
return wrapResponse(empty: true);
} on PlatformException catch (e) {
return wrapResponse(error: e);
} catch (e) {
return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
} catch (e) {
return wrapResponse(
error: PlatformException(code: 'error', message: e.toString()));
}
});
}
Expand Down

0 comments on commit 3e8d488

Please sign in to comment.