getSystemFonts function

Future<List<String>> getSystemFonts()

Retrieves available font families on the current system. Returns an ordered, deduplicated, and filtered list.

Implementation

Future<List<String>> getSystemFonts() async {
  List<String> raw;

  if (kIsWeb) {
    return _fallbackFonts;
  } else if (Platform.isAndroid || Platform.isIOS) {
    raw = await _getMobileFonts();
  } else if (Platform.isLinux) {
    raw = await _getLinuxFonts();
  } else if (Platform.isMacOS) {
    raw = await _getMacOSFonts();
  } else if (Platform.isWindows) {
    raw = await _getWindowsFonts();
  } else {
    return _fallbackFonts;
  }

  if (raw.isEmpty) return _fallbackFonts;

  return _postProcess(raw);
}