When this widget is called, its stuck on loading animation, and when hot reloaded, it shows the transactions `

class TransactionList extends StatefulWidget {
  final int groupIndex;
  final String groupUid;

  const TransactionList(
      {super.key, required this.groupIndex, required this.groupUid});

  State<TransactionList> createState() => _TransactionListState();

class _TransactionListState extends State<TransactionList> {
  Widget build(BuildContext context) {
    final groupTransaction = Provider.of<DocumentSnapshot?>(context);

    if (groupTransaction == null) return const Loading();
    return transactionItemsBuilder(groupTransaction);


edit: this is firebase instance created,

class DatabaseServices {
  final String? uid;


  final CollectionReference groupCollection =

Stream<DocumentSnapshot> get transactions {
    return groupCollection.doc(uid).snapshots();

and this is my stream provider

              initialData: null,
              value: DatabaseServices(uid: widget.item[widget.index].id)
              child: TransactionList(
                  groupIndex: widget.index,
                  groupUid: widget.item[widget.index].reference.id),

Solution 1: Ebin Chandy

Solved this by providing initial data to the stream provider. The data was obtained earlier.