how to import SVG image in flutter? - flutter

I had tried everything like adding dependencies but VS Code don't show that package is downloaded.
I'm unable to use import 'package:flutter_svg/flutter_svg.dart';

You can change indent of flutter_svg in pubspec.yaml
from
flutter:
sdk: flutter
flutter_svg: ^0.19.0
to
flutter:
sdk: flutter
flutter_svg: ^0.19.0

Maybe if you run flutter pub get in the terminal, then flutter clean then restart your vs code it should work

Related

widget_test.dart seems to not detect the app.?

so this the widget_test.dart
and these are the problems
check pubspec.yaml file whether you have included flutter and flutter_test appropriately
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
and make sure indentation in yaml file is correct.
if problem does not solved. run flutter clean and flutter pub get

How to solve Error importing FontAwesome in Flutter

I've installed FontAwesome package from this flutter package repo.
https://pub.dev/packages/font_awesome_flutter
When I paste this line I got an error , import 'package:font_awesome_flutter/font_awesome_flutter.dart';
Target of URI doesn't exist: 'package:font_awesome_flutter/font_awesome_flutter.dart'.
Try creating the file referenced by the URI, or Try using a URI for a file that does exist.
I tried flutter pub get , restarted vsCode many times .
pubspec.yaml :
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
font_awesome_flutter: <latest_version>
http: any
For some reason , that I don't know , changing the project directory solved the problem.

Flutter pub get issue

When I want add video_trimmer package, show this issue
Add this in pubspec.yaml
dependencies:
video_player: ^0.10.9+1
video_trimmer: ^0.2.4

Flutter: packages not added into flutter SDK

We are working on Flutter v1.7.8+hotfix.4, using VS Code added a new package called english_words. the package is updated with all required files in the app but SDK, not updated flutter/packages, here we are unable to see the package folder.
Due to the above issues getting an error from main.dart file
Target of URI doesn't exist 'package:english_words/english_words.dart'.
pubspec.yaml
dependencies:
flutter_test:
sdk: flutter
english_words: ^3.1.5
run flutter packages get got response exit code 0
run flutter pub get or pub get no error.
reload/rebuild the app using flutter run but packages not updated.
pubspec.yaml, pubspec.lock, .packages updated fine.
tried from VS Code Tool click get Packages not solved.
Check if you have this in your pubsec.yaml file
dependencies:
flutter:
sdk: flutter
english_words: ^3.1.5
In you code there is dev_dependencies. Replace this dependency

Flutter can't able to import library

Here is the image_picker i added in pubspec.yaml file
dependencies:
flutter:
sdk: flutter
url_launcher: ^4.0.3
google_maps_flutter: ^0.0.3+3
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
image_picker:
I cant able to import the image picker in my class
Ensure you run flutter packages get
If it still does not work restart your IDE.
I was also facing the same problem. Things that I did and after which it worked for me were:
1. Running the command in the terminal:
flutter packages get
Restarting the IDE
Clearing up all the pending updates.
Hope it helps, make sure all the updates are completed. There's 90 percent chance it will work.