'Dart Flutter image code redirects to image_provider
Code:
import 'package:flutter/material.dart';
void main() {runApp(ModaApp());}
class ModaApp extends StatelessWidget {
const ModaApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: AnaSayfa(),
);
}
}
class AnaSayfa extends StatefulWidget {
AnaSayfa({Key? key}) : super(key: key);
@override
State<AnaSayfa> createState() => _AnaSayfaState();
}
class _AnaSayfaState extends State<AnaSayfa> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Text("Moda Uygulaması", style: TextStyle(fontFamily: "Montserrat", fontSize: 24, fontWeight: FontWeight.bold, color: Colors.black),),
actions: [
IconButton(icon: Icon(Icons.camera_alt), onPressed: () {}, color: Colors.grey,)
],
),
body: ListView(
children: [
Container(
color: Colors.blue,
height: 150,
width: double.infinity,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
listeElemani("assets/model1.jpeg", "assets/chanellogo.jpeg")
],
),
),
],
),
);
}
Widget listeElemani(String imagePath, String logoPath) {
return Column(
children: <Widget>[
Stack(
children: <Widget>[
Container(
height: 75,
width: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
image: DecorationImage(
image: AssetImage(logoPath), fit: BoxFit.contain),
),
)
],
)
],
);
}
}
When I try to run the code it redirects me to a file named image_provider.dart.
There is a code like this in this file:
@override
ImageStreamCompleter load(AssetBundleImageKey key, DecoderCallback decode) {
InformationCollector? collector;
assert(() {
collector = () sync* {
yield DiagnosticsProperty<ImageProvider>('Image provider', this);
yield DiagnosticsProperty<AssetBundleImageKey>('Image key', key);
};
return true;
}());
return MultiFrameImageStreamCompleter(
codec: _loadAsync(key, decode),
scale: key.scale,
debugLabel: key.name,
informationCollector: collector,
);
}
What is the problem? How can I solve it?
Current view:
Appear in my tutorial:
File directory of the project:
My goal is to make a fashion app. But here I am stuck. While my instructor doesn't get errors, I do.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|



