-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listgood first issueRelatively approachable for first-time contributorsRelatively approachable for first-time contributorsp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team
Description
Use case
I am currently working with the Pigeon package in Flutter, where I use enums to define common data types across Swift, Kotlin, and Dart. However, I have encountered an issue with the naming convention for enum cases. Specifically, when using lower camel case for enum cases, Android generates uppercase concatenated strings. As a result, Pigeon currently supports only single-word enum cases.
enum SampleEnum {
sampleVersion,
sampleTest,
}enum class SampleEnum(val raw: Int) {
SAMPLEVERSION(0),
SAMPLETEST(1);
companion object {
fun ofRaw(raw: Int): SampleEnum? {
return values().firstOrNull { it.raw == raw }
}
}
}Proposal
I propose implementing a feature in the Pigeon package that supports defining enum cases in lower camel case, resulting in lower camel case conversion for Swift(maintaining the current behavior) and screaming snake case conversion for Kotlin.
In Kotlin, the corresponding generated code should adopt screaming snake case for enum cases.
enum class SampleEnum(val raw: Int) {
SAMPLE_VERSION(0),
SAMPLE_TEST(1);
companion object {
fun ofRaw(raw: Int): SampleEnum? {
return values().firstOrNull { it.raw == raw }
}
}
}Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listgood first issueRelatively approachable for first-time contributorsRelatively approachable for first-time contributorsp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem teamTriaged by Ecosystem team