decodeAndroidFont static method

HWAndroidFont? decodeAndroidFont(
  1. DartObject? obj
)

Decodes an HWAndroidFont, or null when obj is absent.

Implementation

static HWAndroidFont? decodeAndroidFont(DartObject? obj) {
  if (obj == null || obj.isNull) return null;
  if (getField(obj, 'isCustom')?.toBoolValue() ?? false) {
    return HWAndroidFont.custom;
  }
  final family = getField(obj, 'family')?.toStringValue();
  return family == null ? HWAndroidFont.system : HWAndroidFont.family(family);
}