baaba_api_generator 1.0.1
baaba_api_generator: ^1.0.1 copied to clipboard
build_runner generator for baaba_api_handler: typed, obfuscated API endpoints and environment values from .env files.
1.0.1 #
- A class-form field with a digit in its name finds its key.
s3Bucketlooked forS_3_BUCKETand failed the build against the usualS3_BUCKET— the key the typedef form maps tos3Bucket— and the same foroauth2ClientId,sha256Pinand the like. A digit now stays with the word before it, and an acronym ends before the next word (baseURLPath→BASE_URL_PATH). A file that already uses 1.0.0's spelling (S_3_BUCKET) is still read. - A class-form field named like generated storage is a build error rather than generated code that does not compile. A private field such as
static final String _v0collided with the generator's own_v0and declared it twice; the build now names the field and asks for a rename.
1.0.0 #
First release.
@BaabaApiEndpointgenerates typed endpoints from a.envfile: a key without placeholders becomes a getter (Endpoints.login), one with{name}placeholders a method with those parameters (Endpoints.updateOrder(orderId)), and one with{}placeholders a method witharg1,arg2, … — soenviedfiles work unchanged.@BaabaApiEnvironmentgenerates typed configuration —String,int,boolorUri, nullable or not — parsed and checked at build time.@BaabaApiField(name: ...)names the key a field reads; by defaultbaseUrlreadsBASE_URL, thenbaseUrl.- Obfuscated by default. Each value is stored as a fresh
Random.securekey and the XORed code units, asconstint lists, decoded lazily on first use. The plain value is never written to the generated file — nor hinted at by its length: aboolorintis stored at a fixed width — and every build's output differs. - Build errors name the file, line and key: a missing file (with the
build.yamlsourcesfix spelled out), a missing key, a duplicate key, a malformed placeholder or line, a name that is not a valid Dart identifier, and a value that does not parse as its field's type. - Both annotations work on a
typedef(every key) or a class with static fields (theenviedshape). In a class,constfields are left alone, so it can keep helpers of its own; every other static field needs an explicit type and a key.