Posts

Showing posts with the label database

flutter firebase database initState issue

My app has a object Company that has an attribute shopList. The shoplist will get data from firebase database in void initState() . Company(name: 'Storm', about: 'xxxxxxxxxxxx', backdropPhoto: 'assets/hk.jpg', shopList: [], location: 'HK', logo: 'assets/logo.png', president: 'Grand Production House'); The shoplist is supposed to have 5 different shops, but I don't know why it will have 5 shops with the same data. Code: class CompanyDetailsPage extends StatefulWidget { CompanyDetailsPage( {@required AnimationController controller, this.context}) : animation = new CompanyDetsIntroAnimation(controller); final BuildContext context; final CompanyDetsIntroAnimation animation; @override _CompanyDetailsPageState createState() => _CompanyDetailsPageState(); } class _CompanyDetailsPageState extends State<CompanyDetailsPage> { Shop shopItems; Company storm = Company( ...