HWString class

Inheritance
Implementers

Constructors

HWString(String key, {String? defaultValue, String? previewValue})
const
HWString.localized(String key, {required Map<String, String> defaultTranslations, Map<String, String>? previewTranslations})
A string whose shipped value differs per locale, and which can additionally be overridden per locale at runtime via the generated saveData.
const
factory

Properties

dartType → String
The Dart type string.
no setteroverride
defaultValue → String?
The default value.
final
hashCode → int
The hash code for this object.
no setterinherited
jsonNativeHelpers → List<HWNativeHelper>
nativeHelpers for a read as a leaf of a decoded JSON group, mirroring the androidReadValue / androidJsonReadValue split.
no setterinherited
jsonRenderHelpers → Set<HWNativeHelper>
renderHelpers for a value displayed out of a decoded JSON group, mirroring the nativeHelpers / jsonNativeHelpers split.
no setterinherited
key → String
finalinherited
kotlinType → String
The Kotlin type string.
no setteroverride
leaf → HWDataType
The value type this field ultimately describes.
no setterinherited
nativeHelpers → List<HWNativeHelper>
The native functions reading a stored value of this type back out of its own preferences key.
no setterinherited
previewValue → String?
The sample value the widget gallery shows for this key.
final
renderHelpers → Set<HWNativeHelper>
The native functions called to display a value of this type, before their own dependencies are resolved.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
swiftType → String
The Swift type string.
no setteroverride
timedNativeHelpers → List<HWNativeHelper>
nativeHelpers for a read out of the timed entry active at render time, which is where an HWTimedData field's value comes from instead of a preferences key.
no setterinherited
unwrapped → HWDataType
This type with any time-based wrapper removed.
no setterinherited

Methods

androidReadValue({required String store, required String key, bool preview = false}) → String
Returns the Kotlin code to read this value from SharedPreferences. store is the variable name of the SharedPreferences instance (e.g. "prefs"). key is the full key string (e.g. "${PREFERENCES_PREFIX}.count"). preview reads for the widget gallery, where a stored value still wins but previewValue takes the place of defaultValue behind it.
override
androidToString({required String outerValue, required String innerValue}) → String
Returns the Kotlin code to stringify this value for display. outerValue is the nullable value expression (e.g. "data.count"). innerValue is the non-null value expression (e.g. "data.count").
override
codegenDartDefaultLiteral() → String?
Dart literal representing defaultValue for generated Dart code, or null when there is no default.
inherited
codegenKotlinDefaultLiteral() → String?
Kotlin literal representing defaultValue for generated native code, or null when there is no default.
override
codegenKotlinFallbackLiteral({bool preview = false}) → String?
Kotlin literal a generated read falls back on when the store holds nothing: codegenKotlinPreviewLiteral in a preview that has one, codegenKotlinDefaultLiteral otherwise, and null when there is neither.
inherited
codegenKotlinPreviewLiteral() → String?
Kotlin literal representing previewValue for generated native code, or null when there is no preview value.
override
codegenSwiftDefaultLiteral() → String?
Swift literal representing defaultValue for generated native code, or null when there is no default.
override
codegenSwiftFallbackLiteral({bool preview = false}) → String?
Swift counterpart of codegenKotlinFallbackLiteral.
inherited
codegenSwiftPreviewLiteral() → String?
Swift literal representing previewValue for generated native code, or null when there is no preview value.
override
dartApiType(String widgetClassName) → String
The type the generated Dart API hands this value over as; defaults to dartType.
inherited
dartDecode(String expr, String widgetClassName) → String
expr, which reads this value in its stored form, mapped to dartApiType.
inherited
dartEncode(String expr, String widgetClassName) → String?
expr, which holds this value as dartApiType and is only evaluated when non-null, written back into its stored form; null when the two are the same.
inherited
dartGetDataType(String widgetClassName) → String
The type the generated getData hands this value back as; defaults to dartApiType.
inherited
iosReadValue({required String store, required String key, bool preview = false}) → String
Returns the Swift code to read this value from UserDefaults. store is the variable name of the UserDefaults instance (e.g. "defaults"). key is the full key string. preview behaves as in androidReadValue.
override
iosToString({required String outerValue, required String innerValue}) → String
Returns the Swift code to stringify this value for display. outerValue is the nullable value expression (e.g. "entry.data.count"). innerValue is the non-null value expression (e.g. "entry.data.count!").
override
isCompatibleWith(HWDataType other) → bool
Whether other describes the same field as this one.
inherited
kotlinAccess(String dataExpr) → String
Returns the Kotlin access expression for this value from dataExpr.
inherited
kotlinReadExpr(String dataExpr) → String
Kotlin expression applying widget JSON leaf defaults (HWJson only).
inherited
mergedWith(HWDataType other) → HWDataType<String>
This field carrying the values set by either declaration.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
swiftAccess(String dataExpr) → String
Returns the Swift access expression for this value from dataExpr.
inherited
swiftReadExpr(String dataExpr) → String
Swift expression applying widget JSON leaf defaults (HWJson only).
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited