A Flutter plugin to share images between Flutter and iOS.
This allows Flutter to load images from Images.xcassets and iOS code to load Flutter images.
When loading images from Image.xcassets the device specific variant is chosen (iOS documentation).
iOS | |
---|---|
Support | 12.0+ |
// "flutter" is a resource in Assets.xcassets.
final Image xcassetImage = Image(
image: IosPlatformImages.load('flutter'),
semanticLabel: 'Flutter logo',
);
IosPlatformImages.load
works similarly to UIImage(named:)
.
import ios_platform_images
func makeImage() -> UIImageView {
let image = UIImage.flutterImageWithName("assets/foo.png")
return UIImageView(image: image)
}