Receiving data as null in provider

Issue This is My Repository class DB { final db = FirebaseFirestore.instance; Stream<QuerySnapshot> init(UserModel user) { return db .collection(‘CollectionName’) .doc(user.email) //this is a unique value which i want to retrieve the value from main after successful login .collection(‘New Collection’) .snapshots();

Continue reading

Error: 'sthrow' isn't a type. sthrow ProviderNotFoundException(T, context.widget.runtimeType);

Issue I have problem when I use bloc. /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:7: Error: ‘sthrow’ isn’t a type. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:14: Error: Expected ‘;’ after this. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^^^^^^^^^^^^^^^^^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/provider-6.0.4/lib/src/provider.dart:343:41: Error: Expected ‘)’ before this. sthrow ProviderNotFoundException(T, context.widget.runtimeType); ^ 2 FAILURE:

Continue reading

Flutter: Context in FloatingActionButton cannot find the provider of <Bloc>

Issue It’s my first time using the BLoC pattern in Flutter. I have ran into a problem with providers and context. Here is my main.dart file. import ‘package:flutter/material.dart’; import ‘package:flutter_bloc/flutter_bloc.dart’; import ‘package:my_rescue/modules/screens/homepage/bloc/homepage_bloc.dart’; import ‘package:my_rescue/widgets/drawer.dart’; import ‘package:my_rescue/widgets/text_button.dart’; import ‘package:my_rescue/widgets/weather_forecast.dart’; import ‘package:my_rescue/widgets/app_bar.dart’;

Continue reading