“Muat SVG di ImageProvider Flutter” Kode Jawaban

SVG Flutter

final String assetName = 'assets/image.svg';
final Widget svg = SvgPicture.asset(
  assetName,
  semanticsLabel: 'Acme Logo'
);
S.Mahdi

Muat SVG di ImageProvider Flutter

// ImageProvider does not support SvgPicture.asset()
// the following code will throw an error because flutter_svg package is not compatible with image provider

Container(
  decoration: BoxDecoration(
    image: DecorationImage(
      image: SvgPicture.asset(''),
    ),
  ),
),

// instead, you can use flutter_svg_provider package. It suppports image provider
Unsightly Unicorn

Jawaban yang mirip dengan “Muat SVG di ImageProvider Flutter”

Pertanyaan yang mirip dengan “Muat SVG di ImageProvider Flutter”

Lebih banyak jawaban terkait untuk “Muat SVG di ImageProvider Flutter” di Dart

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya