Here in this article we see how to show loading data icon with properly. We would be using StateNotifier, StateNotifierProvider with AutoDispose. We would also be using future type for state management. Since we are going to simulate data loading from the server, we would need to be dealing with success and failure status. We…
Month: June 2023
Riverpod Listen and Listener
Flutter Riverpod Listener plays an important role when it comes to detecting state that are available. It’s more like BLocConsumer listener. Based on this listener object we will be able to trigger new routes or screen pop or push. This could be use for showing snackBar. Riverpod Listener stores the earlier states. Of course, It’s…
Riverpod Auto Dispose Notifier Provider
Riverpod comes with a lot of terms and options and latest Riverpod has introduced a new term called AutoDisposeNotifierProvider. And what is this AutoDisposeNotifierProvider. In general if you mark your code as @riverpod when generating code of Riverpod using code generation tool, then you can AutoDisposeNotifierProvider. And let’s see an example of a code snippet…
flutter [!] CocoaPods could not find compatible versions for pod “firebase_core”:
The above error happens due iOS swift version and firebase_core version mismatch. To solve this make sure you do the below things See from the above photo that, I have upgrade the platform :ios, ‘13.0’ previously it was ‘11.0’ Use the version as high as possible. After that run flutter pub get Then go to…
Flutter BLoC/Cubit Provider Not Found
As you try to inject Bloc or Cubit to your app, sometimes it maybe that you have the below error In general you get the error due to incorrect place bloc or provider injection. Your MultiProvider or MultiBlocProvider should be at the very top and MaterialApp should be the child of MultiProvider or MultiBlocProvider That’s…
Flutter Cubit or BLoC
First thing you need to know about BLoC, it’s a state management system that works with states and events. With BLoC you need to trigger an event and for that related event you should emit a state. In general events pass data from UI to the shared memory of BLoC or Flutter. Then using state…
Cubit and MultiBlocProvider
If you just use BLoC, you may MultiBlocProvider to inject your blocs at one time. What if you use Cubit? We know Cubit is sub set of BLoC and it works the same as BLoC provider injection. There’s nothing called MultiCubitProvider. From the picture, you see that we have injected all the Cubits using MultiBlocProvider….
Riverpod notifier
We are also able to see notifier object with the latest Riverpod. Notifier object works with ref.read() method. Of course inside ref.read() we need to pass a provider. From the provider object we can notifier The purpose of using notifier object with provider is to invoke a method of the provider and set changes. See…
What does the Riverpod build() method do?
With Riverpod 2.0 or above, it has introduced a new method called build() method. This method is referred inside a class. It’s actually returned as a type. See that we override, the build() method, which means that we can do any operation inside the build() method and return a type. This return type defines the…
Flutter Android image does not show Error: SocketException: Connection refused
Error: SocketException: Connection refused (OS Error: Connection refused, errno = 111), address = 127.0.0.1, port = 52958 If you are using Flutter android and if you have a backend as localhost host, then you might not doing it right when to display the image. In general if you have image loading or api, then in…