How to display SVG image in flutter? | SVG Image From Asset and Network | flutter_svg: ^0.22.0

Опубликовано: 06 Апрель 2023
на канале: True Coders
8,373
56

https://www.youtube.com/@truecoders?s...
‪@TrueCoders‬

Smaple SVG Link
https://dev.w3.org/SVG/tools/svgweb/s...
https://dev.w3.org/SVG/tools/svgweb/s...

how to display an svg image in flutter?

To display an SVG image in Flutter, you can use the flutter_svg package. Here are the steps:
1 Add the flutter_svg package to your pubspec.yaml file:

dependencies:
flutter_svg: ^0.22.0

2 Run flutter pub get to download the package.
3 Import the flutter_svg package in your Dart file:

import 'package:flutter_svg/flutter_svg.dart';

4 Use the SvgPicture.asset or SvgPicture.network constructor to display the SVG image:

SvgPicture.asset(
'assets/images/my_image.svg',
width: 200,
height: 200,
),


Or

SvgPicture.network(
'https://example.com/my_image.svg',
width: 200,
height: 200,
),


In the above examples, the width and height parameters specify the dimensions of the SVG image in the Flutter app. You can adjust these values to suit your needs.
Note: Make sure that the SVG image file is located in the assets folder (for SvgPicture.asset) or accessible from the internet (for SvgPicture.network).


Смотрите видео How to display SVG image in flutter? | SVG Image From Asset and Network | flutter_svg: ^0.22.0 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь True Coders 06 Апрель 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 8,373 раз и оно понравилось 56 людям.