When I include 2x images only, it will show The asset assets/icons/xxx.png does not exist.
.
Must I include the 1x image version? Since iOS iPhones all provide retina screen(2x or 3x).
PS: I was making a app support iPhone only, and iOS 12+
from the flutter documentation
The main asset is assumed to correspond to a resolution of 1.0. For example, consider the following asset layout for an image named my_icon.png:
content_copy .../my_icon.png .../2.0x/my_icon.png .../3.0x/my_icon.png
On devices with a device pixel ratio of 1.8, the asset
.../2.0x/my_icon.png
would be chosen. For a device pixel ratio of 2.7, the asset.../3.0x/my_icon.png
would be chosen.Each entry in the asset section of the pubspec.yaml should correspond to a real file, with the exception of the main asset entry. If the main asset entry does not correspond to a real file, then the asset with the lowest resolution is used as the fallback for devices with device pixel ratios below that resolution. The entry should still be included in the pubspec.yaml manifest, however.
You may include the 1x Image to accommodate for older iPads and iPhones.
It is possible but you'll need to add them to pubspec.yaml
directly.
So, if you have <path>/2.0x/image.webp
and <path>/3.0x/image.webp
, then you add
- <path>/image.webp
to pubspec.yaml
and it'll work even if there's no image.webp in path.