flutter_web icons - не отображаются в Windows или MacOS

Егор Долгов · 08.05.2019
Archive material: it describes Flutter as of publication and is not updated.

При запуске Progressive Web Application built with Flutter можно столкнуться с тем, что иконки не отображаются (отображаются спецсимволом квадратом).

Material icons not rendering #32245 https://github.com/flutter/flutter/issues/32245

! А на смартфоне проблем нет !

Решается проблема добавлением файла FontManifest.json

  1. создайте директорию assets в существующей директории web
  2. создайте файл FontManifest.json
  3. добавьте в него следующее содержимое
[
    {
      "family": "MaterialIcons",
      "fonts": [
        {
          "asset": "https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2"
        }
      ]
    }
  ]

Пример FontManifest.json взят отсюда: https://github.com/flutter/samples/blob/master/web/charts/example/web/assets/FontManifest.json

1.

Сохраните файл FontManifest.json

2.

После горячей перезагрузки иконки будут отображаться