skip to Main Content

Showing empty widget while FutureBuilder is loading data – Flutter

I have the following FutureBuilder: child: FutureBuilder( future: fetchNotifications(widget.usuarioId), builder: (context, snapshot) { if (snapshot.hasData) { List<dynamic>? filteredList = snapshot.data as List; return ListView.separated( separatorBuilder: (BuildContext context, int index) => new Divider( color: Colors.black26, thickness: 0.5, ), itemCount: filteredList.length, shrinkWrap:…

VIEW QUESTION

Flutter dropdown with future builder

This is my data model class RoleModel { int? id; String? role; RoleModel({this.id, this.role}); RoleModel.fromJson(Map<String, dynamic> json) { id = json['id']; role = json['role']; } Map<String, dynamic> toJson() { final Map<String, dynamic> data = <String, dynamic>{}; data['id'] = id; data['role']…

VIEW QUESTION

Flutter FutureBuilder stuck at ConnectionState.waiting

I'm new and currently learning Flutter, I have a question about FutureBuilder. My code is stuck at ConnectionState.waiting and I'm not sure why. My codes are import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; class DartPad extends StatefulWidget { const…

VIEW QUESTION
Back To Top
Search