Skip to content

[pigeon] Use non-nullable generics in example app #7817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2024
Merged
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: 2 additions & 2 deletions packages/pigeon/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MessageData {
String? name;
String? description;
Code code;
Map<String?, String?> data;
Map<String, String> data;
}

@HostApi()
Expand Down Expand Up @@ -103,7 +103,7 @@ Future<int> add(int a, int b) async {
Future<bool> sendMessage(String messageText) {
final MessageData message = MessageData(
code: Code.one,
data: <String?, String?>{'header': 'this is a header'},
data: <String, String>{'header': 'this is a header'},
description: 'uri text',
);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ data class MessageData(
val name: String? = null,
val description: String? = null,
val code: Code,
val data: Map<String?, String?>
val data: Map<String, String>
) {
companion object {
fun fromList(pigeonVar_list: List<Any?>): MessageData {
val name = pigeonVar_list[0] as String?
val description = pigeonVar_list[1] as String?
val code = pigeonVar_list[2] as Code
val data = pigeonVar_list[3] as Map<String?, String?>
val data = pigeonVar_list[3] as Map<String, String>
return MessageData(name, description, code, data)
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/example/app/ios/Runner/Messages.g.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ struct MessageData {
var name: String? = nil
var description: String? = nil
var code: Code
var data: [String?: String?]
var data: [String: String]

// swift-format-ignore: AlwaysUseLowerCamelCase
static func fromList(_ pigeonVar_list: [Any?]) -> MessageData? {
let name: String? = nilOrValue(pigeonVar_list[0])
let description: String? = nilOrValue(pigeonVar_list[1])
let code = pigeonVar_list[2] as! Code
let data = pigeonVar_list[3] as! [String?: String?]
let data = pigeonVar_list[3] as! [String: String]

return MessageData(
name: name,
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/example/app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class _MyHomePageState extends State<MyHomePage> {
Future<bool> sendMessage(String messageText) {
final MessageData message = MessageData(
code: Code.one,
data: <String?, String?>{'header': 'this is a header'},
data: <String, String>{'header': 'this is a header'},
description: 'uri text',
);
try {
Expand Down
4 changes: 2 additions & 2 deletions packages/pigeon/example/app/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MessageData {

Code code;

Map<String?, String?> data;
Map<String, String> data;

Object encode() {
return <Object?>[
Expand All @@ -65,7 +65,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
2 changes: 1 addition & 1 deletion packages/pigeon/example/app/pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MessageData {
String? name;
String? description;
Code code;
Map<String?, String?> data;
Map<String, String> data;
}

@HostApi()
Expand Down