The following _TypeError was thrown building StreamBuilder<QuerySnapshot<Object?>>(dirty, state: _StreamBuilderBaseState<QuerySnapshot<Object?>, AsyncSnapshot<QuerySnapshot<Object?>>>#b3917): type 'Null' is not a subtype of type 'String' #9006
Unanswered
kaushik2103
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:residency/constants.dart';
import 'package:residency/widgets/home_screen_header.dart';
import '../../widgets/add_bar.dart';
import '../../widgets/big_card_details.dart';
import '../../widgets/big_card_owner_name.dart';
import '../../widgets/big_card_total_houses.dart';
class TotalHouseDetails extends StatefulWidget {
const TotalHouseDetails({Key? key}) : super(key: key);
@OverRide
State createState() => _TotalHouseDetailsState();
}
class _TotalHouseDetailsState extends State {
final CollectionReference _totalHouses =
FirebaseFirestore.instance.collection('add_houses');
Stream? _streamTotalHouses;
@OverRide
void initState() {
super.initState();
_streamTotalHouses = _totalHouses.snapshots();
}
@OverRide
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
return SafeArea(
child: Scaffold(
backgroundColor: Colors.black,
appBar: PreferredSize(
preferredSize: Size.fromHeight(screenHeight * 0.07),
child: AppBarWithIcon(
screenHeight: screenHeight,
appBarName: 'Houses',
),
),
body: Container(
width: double.infinity,
height: double.infinity,
decoration: const BoxDecoration(
color: Color(scaffoldBackgroundColor),
),
child: StreamBuilder(
stream: _streamTotalHouses,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasError) {
return const Center(child: Text('Something went wrong!'));
}
}
}
/*
Container(
width: double.infinity,
height: double.infinity,
decoration:
const BoxDecoration(color: Color(scaffoldBackgroundColor)),
child: SingleChildScrollView(
child: Column(
children: [
HomeScreenHeader(
screenWidth: screenWidth,
screenHeight: screenHeight,
homeScreenHeader: 'Total Houses',
),
SizedBox(
height: screenHeight * 0.03,
),
Padding(
padding: EdgeInsets.only(
left: screenWidth * 0.05,
right: screenWidth * 0.05,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BigCardTotalHouses(
screenHeight: screenHeight,
screenWidth: screenWidth,
ownerName: 'Dhruv Tillu',
blockNo: 'A',
mobileNo1: '1234567890',
houseNo: '101',
mobileNo2: '1234567890',
members: '5',
),
],
),
),
],
),
),
),
*/
Beta Was this translation helpful? Give feedback.
All reactions