Error message for floating button
//Floating button
floatingActionButton: SpeedDial(
//button size
buttonSize: const Size(70, 70),
// color
backgroundColor: Color.fromRGBO(255, 114, 94, 1),
child: Icon(Icons.add),
children: [
SpeedDialChild( //speed dial child
child: Image.asset("test.png", fit: BoxFit.fitWidth,),
),
],
),
!error message occured when insert image to floating button]1
2
Answers
Your Asset Image Path is Incorrect. This error shows that there is no test image or file in the assets folder.
Go to Pubspec.yaml file enable the assets folder and create a folder the same as the name in the project directory. and paste your photo here, then you just need to set the absolute path of the image in image.asset().
Try using the absolute path in Image.asset, and make sure that you’ve added that asset directory path in the pubspec.yaml file.
Check reference for adding assets into pubspec file