Images in Flutter
- In Flutter, images are an essential part of building visually appealing applications. Flutter provides several ways to work with images, including loading images from assets, network, and file system.
If you want to load the image from URL
Image.network('https://images.unsplash.com/photo-1500835556837-99ac94a94552?w=600&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Nnx8dHJhdmVsbGluZ3xlbnwwfHwwfHx8MA%3D%3D')If you want to load the image from assets
- First, create directory
imagesin your project root and add your image there. - Then, go to
pubspec.yamlfile and add the following lines:
flutter:
assets:
- images///TODO: Add a ss and link of youtube video explaining this step
3. Finally, use the Image.asset widget to display the image:
Image.asset('assets/images/your_image.png')//TODO: Add a ss and link of youtube video explaining this step