withBundledEmojiFallback function
Appends the emoji fallback families to style so emoji in that text render
offline on web.
Returns style untouched off the web, where the platform already provides
a color emoji font.
Implementation
TextStyle? withBundledEmojiFallback(TextStyle? style) {
if (!kIsWeb) return style;
final existing = style?.fontFamilyFallback ?? const <String>[];
final families = bundledEmojiFallbackFamilies()
.where((family) => !existing.contains(family))
.toList();
if (families.isEmpty) return style;
return (style ?? const TextStyle()).copyWith(
fontFamilyFallback: [...existing, ...families],
);
}