package:flutter/src/widgets/framework.dart "ERROR"

Viewed 273

I have this Error in FutureBuilder when I run the error message in the console is:

'Widget' is from 'package:flutter/src/widgets/framework.dart' ('../../developer/flutter/packages/flutter/lib/src/widgets/framework.dart').
package:flutter/…/widgets/framework.dart:1
        builder: (context, snapshot) {
                 ^import 

      body: FutureBuilder<QuerySnapshot>(

        future: userref.get(),
        builder: (context, snapshot){
          if (snapshot.hasData) {
            return ListView.builder(
              itemCount: snapshot.data!.docs.length,
              itemBuilder: (context, index) {
                return Text(snapshot.data!.docs[index]['username'].toString());
              },
            );
          } if (snapshot.hasError){
            return const Text('Error');
          }
          if (snapshot.connectionState == ConnectionState.waiting){
            return const Text('Error');
          }
        }
    ));
  }
}

  

0 Answers
Related