expect/actual Classes & Properties
Beyond functions: declarations you can expect/actual.
Beyond Functions
expect/actual is not limited to functions. You can also declare whole classes, properties, and even objects that differ per platform.
An expect Property
Need a value that each platform defines? Declare an expect val in commonMain and let every target supply the actual value.
expect val platformName: StringAll lessons in this course
- Why expect/actual Exists
- Get the Platform Name per Target
- expect/actual Classes & Properties
- Common Mistakes & Compiler Errors