When i select image from image picker i am getting this error type file is not a subtype of type 'imageprovider dynamic '
I tried using stack even though the same error class _ProfileState extends State<Profile> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( automaticallyImplyLeading: true, title: Text('Profile'), centerTitle: true, elevation: 10.0, ), body: Container( decoration: BoxDecoration( image: DecorationImage( image: _imageFile == null ? AssetImage('assets/tom.jpg') : _imageFile, fit: BoxFit.cover)), child: ListView( children: <Widget>[ Container( height: MediaQuery.of(context).size.height / 1.4, ), Card( color: Colors.grey.withOpacity(0.1), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0)), child: cameraAndEdit(context), ), Container( width: MediaQuery.of(context).size.width, color: Colors.white70, child: Padding( padding: const EdgeInsets.all(8.0), child: Column( children: <Widget>[ box(), line(color: Colors.deepPurple, lineHeight: 5.0), // nameDesignation(), infoRow( infoIcon: Icon(Icons.person), infoText: 'Name', detail: 'Tom Cruise', textColor: Colors.black), Divider(), infoRow( infoIcon: Icon(Icons.location_on), infoText: 'Address', detail: '#9/1 1st main Circle street Bangalore 560-096', textColor: Colors.black), Divider(), infoRow( infoIcon: Icon(Icons.gesture), infoText: 'Age', detail: '25', textColor: Colors.black), Divider(), infoRow( infoIcon: Icon(Icons.phone), infoText: 'Phone', detail: '+91 9148046273', textColor: Colors.black), line(color: Colors.deepPurple, lineHeight: 5.0), box(), ], ), ), ), ], ), ), ); }
image: _imageFile == null ? AssetImage('assets/tom.jpg') : _imageFile,
should be
image: _imageFile == null ? AssetImage('assets/tom.jpg') : FileImage(_imageFile),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With