ably_flutter 1.2.40
SDKflutter
Platformandroidios
A wrapper around Ably's Cocoa and Java client library SDKs, providing iOS and Android support.
Code generation to keep platform constants in sync
There are many platform constants that need to be sync on dart side and platform side. Following are the constants that are being generated:
- codec types
- platform method and event names
- serializable property names for serialization and de-serialization
Generating files
cd bin
dart codegen.dart
Template format
A straight forward templates creating using dart string interpolation:
Template and Context files
source template files are available in bin/templates
and source context data in bin/codegencontext.dart.
Generated files
These files are generated/modified upon code generation
lib/src/generated/platformconstants.dartfor use in Flutter/Dartandroid/src/main/java/io/ably/flutter/plugin/generated/PlatformConstants.javafor use in Android/Javaios/Classes/codec/AblyPlatformConstants.hfor use in iOS/Objective-Cios/Classes/codec/AblyPlatformConstants.mfor use in iOS/Objective-C
When would I need to run code generation?
When any of the below need to be added/updated
- A new codec type - required when a new top level serializable object is required (ex:
ErrorInfoandClientOptions) - Platform and event names - when implementing a new method in
MethodChannelor new event inEventChannel - A new object needs to be serialized (either top-level, or nested)
What should I do after running code generation?
- Test that everything still works
- Commit changes to the template(s)
- Commit changes to the generate files