home_widget_generator_cli library
Libraries exported exclusively for use by the home_widget_cli package.
These exports are considered internal implementation details of the
home_widget_generator and are not subject to semantic versioning
guarantees for general public use.
Classes
- WidgetTreeParser
- Parses a @HomeWidget annotation into an HWWidget.
- WidgetValueDecoder
-
Decodes a
DartObjectrepresenting a widget tree into an HWWidget.
Enums
- GlanceSizeAxis
- An axis a Glance modifier chain can size.
Constants
-
dartReservedWords
→ const Set<
String> - Dart's reserved words, which no generated identifier may take.
Functions
-
applySwiftModifier(
String childCode, String modifier, int indent) → String -
Appends a SwiftUI view modifier (e.g.
.frame(...),.background(...)) tochildCode. -
escapeDartStringLiteral(
String s) → String -
Escapes
sfor embedding in a Dart single-quoted string literal. -
escapeKotlinStringLiteral(
String s) → String -
Escapes
sfor embedding in a Kotlin double-quoted string literal. -
escapeSwiftStringLiteral(
String s) → String -
Escapes
sfor embedding in a Swift double-quoted string literal. -
fnv1a32(
String input) → int - 32-bit FNV-1a hash.
-
hwCodePointLiteral(
int codePoint) → String -
codePointas the hexadecimal literal a glyph is usually written as, which both platforms read the same way. -
hwSizeLiteral(
double size) → String -
sizeas a literal both platforms read as a number, without the trailing.0a whole Dart double stringifies with. -
hwValidateCodePoint(
int codePoint, String source) → void -
Throws a GeneratorError when
codePointis no glyph a widget can be generated for, namingsourceas what holds it. -
injectGlanceModifier(
String code, String modifier, {GlanceSizeAxis? weightAxis}) → String -
Helper to parse a typical Compose call (e.g.
Column {orText(...)) and inject a modifier string (e.g.fillMaxSize()). -
wrapGlanceRootContent(
String code, {required String modifier, String contentAlignment = 'Alignment.Center'}) → String -
Wraps the widget tree in a full-size
BoxwithcontentAlignment.
Exceptions / Errors
- GeneratorError
- Error thrown when widget generation fails.