Home > Software engineering >  Undefined name "imageList" when i used PageView in Flutter
Undefined name "imageList" when i used PageView in Flutter

Time:05-20

I tried to fix it by anyway by import,... but it still running error!

[Error] https://i.stack.imgur.com/36Jhv.png

https://i.stack.imgur.com/lqhLT.png

CodePudding user response:

Use LeadingImages().imageList instead of imageList

CodePudding user response:

you can't access any class property directly in dart so you have to first import file where your class is and then you have to call that method there is two ways to do this

  1. get instance of class in object and use it may help you to improve performance of app
LeadingImages leadingImages = LeadingImages();
leadingImages.imageList;
  1. or you can use like this
LeadingImages().imageList;
  • Related