Ask Your Question
3

How can I retrieve an SVG image from a URL in Flutter?

asked 2022-10-05 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-20 08:00:00 +0000

qstack gravatar image

You can retrieve an SVG image from a URL in Flutter by using the flutter_svg package. Here is an example code snippet:

  1. Add the flutter_svg package to your pubspec.yaml file:
dependencies:
  flutter:
    sdk: flutter
  flutter_svg: ^0.22.0
  1. Import the flutter_svg package:
import 'package:flutter_svg/flutter_svg.dart';
  1. Use the SvgPicture.network() widget to retrieve and display the SVG image:
SvgPicture.network(
  'https://example.com/image.svg',
  height: 100,
  width: 100,
),

This will retrieve the image from the URL https://example.com/image.svg and display it with a height and width of 100.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-10-05 11:00:00 +0000

Seen: 14 times

Last updated: May 20 '21