Flutter Provider - A Follow up to my Architecture Guide

preview_player
Показать описание
Sharing data timestamp - 03:55

Рекомендации по теме
Комментарии
Автор

coming from world where DI/IOC is the thing flutter your architecture is the best i have seen lately in You!

thechrisgate
Автор

If you're following along with this tutorial ignore the dispose section. The provider package already calls dispose on the model. All you have to do is override inside the model, but calling dispose again in the base view will cause an exception to be thrown in the code.


If you're getting the disposed exception remove the dispose override from the base view.

FilledStacks
Автор

I love how you created that video based on the community responses. Thx bruv

cloud
Автор

Super helpful for a newcomer like me to flutter and state management world ! Thanks

peace
Автор

You are the man, this is the best architecture.

getmmg
Автор

great tutorial and the best choice for the average programmer to start with .

berosolo
Автор

Hi FilledStacks Great video, it helped a lot in understanding the architecture, I followed almost all the series of architecture its great but i have a question, it would be great if you can help me out in this and that is using "get_it" and "provider" posts are not changing likes count on home screen unless you scroll to bottom, i have read all the comments and tried everything but it just doesn't work, if you can provide the latest code where everything works with "get_it" and "provider" that would be great, and i have already tried "010-provider-architecture", and they doesn't update counts on home screen. Looking forward for your response.
Thank you.

ALIHAIDER-ordw
Автор

Hey! First of all thanks for the videos, I'm finding them very helpful. One thing that I'd like to know Is how to deal with streams with this type of architecture, I already built a fairly complex app using the Bloc pattern and dealing with streams is really easy. However, It feels cumbersome at times so I'm exploring other options such as provider. More specifically I'm talking about using Firestore as your database and listening for updates (in the form of streams) on objects. Thanks a lot!

marianouvalle
Автор

Some clarifications...in the article, it was said

"Don't add the dispose into the BaseView. Instead just override your dispose function in your ChangeNotifier, it will be called by provider when it goes out of scope"

But on the video, 3:43 you literally add the dispose on baseview, is baseview and changeNotifier different?
and when I did that I got "Once you have called dispose() it can no longer be used".

karmnoddie
Автор

This reminds me how people use to store data in services with angular 2+. But storing data in services was not the most maintainable approach and ngxs and ngrx was preferred. What if you have 2 widgets on the same screen that are grabbing data from the same service. Then the data is changed in one widget, what happens to the other widget? Is it reactive?

wolfgangstm
Автор

Hi @Filledstacks... I got 3 questions if you don't mind answering please; in the PostsService:


1. The method getPostsForUser updates the _posts list directly. Since the service is registered as Singleton, wouldn't that mean that all reference to posts in the app will be overwritten with the posts of a single user? i.e. To maintain the reference of all users, shouldn't we save the result of getPostsForUser in a different list?


2. Assume you want to call the api to add or create a post; how would go about that? You call the api to save it in the backend then save it locally in memory?


3. I'm noticing when returning Futures that you don't actually return anything. Don't you need to return something for the Future?

drimadoh
Автор

hey thanks so much for the tutorial, it's been amazing following along. But say I want to implement a login/logout feature, where the app will redirect to HomeView every time it is opened IF there's a user currently logged into the app (and go to LoginView if there is no user logged in currently). To use the User StreamProvider wrapping the MaterialApp in main.dart could be the way but I don't know how to implement it correctly. Can you elaborate to implement that alongside this whole architecture? Thank you

BVideos
Автор

Thanks for the nice tutorial. I am running 002-final. And when I enter userId for the first time and click login, the HomeView does not contain any posts, because fetching of posts occurs for the user provided by User.initial() with id=0. This only happens for the first login after starting the application. How to solve this problem?

sergeystorozhev
Автор

Thank you for being awesome . can you make a video on how to manage an app using provider online and offline

armstrongsama
Автор

Great tutorial! Thank you for teaching how to set up an architecture. I have a question. When I click the first post, and after that click the like button to increment likes, and after that go back to list of posts, it seems like the likes count wasn't incremented at first glance. However, when I scroll down the page until the end and then scroll up till the first post, it increments. Why does it work like this?

eturkoz
Автор

Great tutorial, its super helpful. I need dome help, when I click like button to increment likes, then I go back to list of posts,

likes are indeed incremented but now when i go to same post view or any other to increment likes i see error:
Another exception was thrown: A LikeButtonModel was used after being disposed.
I/flutter (28838): Another exception was thrown: A CommentsModel was used after being disposed.

LeonardKinyanjui_elk
Автор

Thanks for the tutorial, this is the best Flutter architecture i found. But I have some questions for you. First, when I put print statement in HomeView build method it fires immediately when app starts (LoginView). I think this is not normal behaviour? Second, when i click like button on PostView screen, number of likes are changed but when i go back to HomeView screen, number of likes are not changing before I start scrolling list of posts?

srdjandjukanovic
Автор

After building a complex app with this architecture, I keep getting this error.


"Unhandled Exception: A (any)Model was used after being disposed."


And through my observation, it happens when I run a function in 'onModelReady' on 1 page, but navigate to another page while the onModelReady function is still not done yet.


Have you faced similar issue before? or any insights on what might cause it?


Thanks boss.

alvin
Автор

Thank you Sir, very helpful tuto, can i use Provider state managment for big or large projects ?

ayoubBoumzebra
Автор

Hello FilledStacks! Great video, it helped me alot in organizing my code.
I have a question, I'm trying to implement a searchfunction in my app that utilizes a placeholder restAPI. I would like to keep using your type of code structure and state management. Would you recommend using the SearchDelegate to achieve this or would you go for another approach?
Best regards
Red

jhvkgvb
join shbcf.ru