skip to Main Content

future: FirebaseAuth.instance.currentUser(), throws an error, need alternatives – Flutter

I have seen various questions about the same topic, and realized that 'currentUser' does not go with future after the update in FirebaseAuth import 'package:flutter/material.dart'; import 'package:firebase_auth/firebase_auth.dart'; class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState…

VIEW QUESTION

Reference error: self is not defined when implementing firebase messaging

In my Nextjs project I'm trying to implement push notification with firebase messaging (my firebase version is 8.10.0), after creating the firebase-messaging-sw.js file in my public folder: importScripts( "https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js" ); importScripts( "https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js" ); const firebaseConfig = { apiKey: "***", authDomain:…

VIEW QUESTION

Flutter firestore database returns null

I have following code: I use cloud firestore as database UserModel: class DbUser { String id; final String authUserID; final String userName; final List<String>? itemsForSale; final List<String>? itemFavourites; final List<String>? bids; DbUser( {this.id = '', required this.authUserID, required this.userName, this.itemsForSale,…

VIEW QUESTION

Flutter – Null check operator used on a null value Error when use StreamBuilder

When using StreamBuilder it shows below error. The following _CastError was thrown building StreamBuilder<DocumentSnapshot<Map<String, dynamic>>>(dirty, state: _StreamBuilderBaseState<DocumentSnapshot<Map<String, dynamic>>, AsyncSnapshot<DocumentSnapshot<Map<String, dynamic>>>>#65942): Null check operator used on a null value My try:  I set CircularProgressIndicator for ConnectionState.none, ConnectionState.waiting,!streamSnapshot.hasData   It didn't work. There is…

VIEW QUESTION
Back To Top
Search