Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 26.1.11

* [dart] Improves nullability-handling in generated code.

## 26.1.10

* Dramatically reduces the number of File write operations sent to the operating
Expand Down
28 changes: 12 additions & 16 deletions packages/pigeon/example/app/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class MessageData {
name: result[0] as String?,
description: result[1] as String?,
code: result[2]! as Code,
data: (result[3] as Map<Object?, Object?>?)!.cast<String, String>(),
data: (result[3]! as Map<Object?, Object?>).cast<String, String>(),
);
}

Expand Down Expand Up @@ -181,12 +181,12 @@ class ExampleHostApi {
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;

final Object pigeonVar_replyValue = _extractReplyValueOrThrow(
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList,
pigeonVar_channelName,
isNullValid: false,
)!;
return pigeonVar_replyValue as String;
);
return pigeonVar_replyValue! as String;
}

Future<int> add(int a, int b) async {
Expand All @@ -202,12 +202,12 @@ class ExampleHostApi {
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;

final Object pigeonVar_replyValue = _extractReplyValueOrThrow(
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList,
pigeonVar_channelName,
isNullValid: false,
)!;
return pigeonVar_replyValue as int;
);
return pigeonVar_replyValue! as int;
}

Future<bool> sendMessage(MessageData message) async {
Expand All @@ -223,12 +223,12 @@ class ExampleHostApi {
);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;

final Object pigeonVar_replyValue = _extractReplyValueOrThrow(
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList,
pigeonVar_channelName,
isNullValid: false,
)!;
return pigeonVar_replyValue as bool;
);
return pigeonVar_replyValue! as bool;
}
}

Expand All @@ -255,12 +255,8 @@ abstract class MessageFlutterApi {
pigeonVar_channel.setMessageHandler(null);
} else {
pigeonVar_channel.setMessageHandler((Object? message) async {
assert(
message != null,
'Argument for dev.flutter.pigeon.pigeon_example_package.MessageFlutterApi.flutterMethod was null.',
);
final List<Object?> args = (message as List<Object?>?)!;
final String? arg_aString = (args[0] as String?);
final List<Object?> args = message! as List<Object?>;
final String? arg_aString = args[0] as String?;
try {
final String output = api.flutterMethod(arg_aString);
return wrapResponse(result: output);
Expand Down
11 changes: 7 additions & 4 deletions packages/pigeon/lib/src/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ class TypeDeclaration {
}
}

/// Returns duplicated `TypeDeclaration` with attached `associatedEnum` value.
/// Returns a new [TypeDeclaration] with [enumDefinition] as the
/// [associatedEnum] value.
TypeDeclaration copyWithEnum(Enum enumDefinition) {
return TypeDeclaration(
baseName: baseName,
Expand All @@ -565,7 +566,8 @@ class TypeDeclaration {
);
}

/// Returns duplicated `TypeDeclaration` with attached `associatedClass` value.
/// Returns a new [TypeDeclaration] with [classDefinition] as the
/// [associatedClass] value.
TypeDeclaration copyWithClass(Class classDefinition) {
return TypeDeclaration(
baseName: baseName,
Expand All @@ -575,7 +577,8 @@ class TypeDeclaration {
);
}

/// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value.
/// Returns a new [TypeDeclaration] with [proxyApiDefinition] as the
/// [associatedProxyApi] value.
TypeDeclaration copyWithProxyApi(AstProxyApi proxyApiDefinition) {
return TypeDeclaration(
baseName: baseName,
Expand All @@ -585,7 +588,7 @@ class TypeDeclaration {
);
}

/// Returns duplicated `TypeDeclaration` with attached `associatedProxyApi` value.
/// Returns a new [TypeDeclaration] with [types] as the [typeArguments] value.
TypeDeclaration copyWithTypeArguments(List<TypeDeclaration> types) {
return TypeDeclaration(
baseName: baseName,
Expand Down
Loading
Loading