android_system_font_weight
Read Android system font-weight data through two synchronous APIs.
import 'package:android_system_font_weight/android_system_font_weight.dart';
getRawData()
Returns a Map<String, String> containing device information, raw font
settings and probe results. Use it to write your own device-specific logic.
Results are cached; pass refresh: true to collect again.
final data = AndroidSystemFontWeight.getRawData();
final refreshed = AndroidSystemFontWeight.getRawData(refresh: true);
Non-Android platforms or collection failures return an empty map.
getWght()
Calls getRawData() internally and applies the built-in device policy.
Returns a double? in the wght range 100–1000, or null to keep the
existing font style. No arguments are required.
final weight = AndroidSystemFontWeight.getWght();
The policy handles OPPO, Xiaomi, vivo and Honor families. Huawei, Samsung,
Google and other unsupported devices return null. OPPO has been tested;
other supported families still need device validation.
Apply a non-null result with FontVariation('wght', weight) when the font
used by Flutter supports the wght axis.
Libraries
- android_system_font_weight
- 同步读取安卓字重原始 Map,提供可由调用方替换的厂商取值参考函数。