Questions tagged [inherited-widget]

63 questions
1
vote
1 answer

Why do I need an InheritedWidget in Flutter

I've started to learning about Flutter's inherited widgets and i have a question. Why do we need an InheritedWidget if we can get data from context.findAncestorOfExactType? And that updateShouldNotify... Like, it notifies child widgets when some…
CyberSeal
  • 11
  • 1
1
vote
0 answers

Didier Boelens' Reactive Programming BLoC or how to implement an app wide BLoC

I was looking into quite a few pages to learn how to best implement an app wide bloc (for authentication, user management and initialization). I did not find so much and for a beginner regarding this level of bloc patterns I found it hard to…
w461
  • 2,168
  • 4
  • 14
  • 40
1
vote
0 answers

Flutter: Merging 2 InheritedWidget as parent for MaterialApp

Can a child widget (MaterialApp) inherit from 2 separate inherited widgets? Like I need one inherited widget for translation (LocalizationProvider) and another for navigation (AppStateProvider). They work fine separately but unable to make them work…
fida1989
  • 3,234
  • 1
  • 27
  • 30
1
vote
1 answer

Flutter: How Do I Properly Seat a Provider.of Method into a StatefulWidget so Dispose() Can Be Used in My Code?

Introduction: I have spent over an hour looking through StackOverflow seeking this answer; so, I have hesitantly decided to ask this question which I believe is unanswered. I hope that it am not repeating something that has been answered Ad…
George Lee
  • 814
  • 18
  • 34
1
vote
0 answers

Flutter Inhertied widgets in a widget (stateless of statefull)

in Flutter we access an inherited widget fields by using its static of method: Inhertied_widget.of(context).wanted_field so, my question is, in a widget (stateless or statefull) when we use something like this: final ScreenArguments args =…
Jalil.Jarjanazy
  • 839
  • 1
  • 9
  • 22
1
vote
1 answer

How to access data of child widget in parent in flutter?

I want to know the value of a certain field in a child (or child of child) widget in the parent widget, only when I want to know it. Using a Callback or InheritedWidget/Provider doesn't work in this case as it provides me information every time…
RoyalGriffin
  • 1,987
  • 1
  • 12
  • 25
1
vote
1 answer

Flutter: inherited widget

I want to do a login app. I have a class user, which has an id and a username that I want to keep to display it later in the app, and I have a user_api class, where I do the http request. I wanted to use Singleton to store the user once the user…
Little Monkey
  • 5,395
  • 14
  • 45
  • 83
1
vote
1 answer

Flutter Inherited Widget - Missing some listener

I'm trying to get the following to work. Changes to the app model state are not picked up via the InheritedWidget 'AppStateProvider'. I've manage to get this working with sinks/streams but was hoping to established a simpler structure. This is just…
Yarm
  • 1,178
  • 4
  • 16
  • 29
1
vote
1 answer

Get access to the context of InheritedWidget

I am having the following setup: MaterialApp(home:SplashScreen) SplashScreen( ///do some auth checks then Navigator.of(context).push( MaterialPageRoute( builder: (_) => StateInheritedWidget( user: userData, …
Shady Aziza
  • 50,824
  • 20
  • 115
  • 113
0
votes
1 answer

Does the InheritedWidget's updateShouldNotify need to exist?

The official comment of updateShouldNotify says it can control the InheritedWidget's child build or not when the InheritedWidget is rebuild. /// Whether the framework should notify widgets that inherit from this widget. /// /// When this…
ximmyxiao
  • 2,622
  • 3
  • 20
  • 35
0
votes
1 answer

Widget will not rebuild when listening to the value of Flutter Provider exposed

In my code I will use Provider.value to expose a value to MyHomePage ,at the same time ,the MyHomePage will use Provider to get the value with the listen set to true,If i change the value outside , the MyHomePage will not rebuild , seems the…
ximmyxiao
  • 2,622
  • 3
  • 20
  • 35
0
votes
0 answers

how pass class as provider in inherited widget class

I am trying to use InheritedWidget approach to share state down the Widget tree and i use three classes one is Bloc class i want to pass as a provider second class is Provider class to pass Bloc class as provider and the third class is implement…
Endale
  • 9
  • 1
0
votes
1 answer

How do I access my inherited widget in a dart file that doesn't build a widget in the tree?

I'm following this example to add my very first InheritedWidget into my app. I've created my _state_container.dart file and now want to use it. To start, I'd like to use it in the widget where I display the chats in a group chat. This widget is in…
whatwhatwhat
  • 1,991
  • 4
  • 31
  • 50
0
votes
1 answer

Does Inherited Widget changes rebuild whole application when it's the parrent of MaterialApp?

I want to use InheritedWidget to access and change its data from anywhere in application. I've read many articles about InheritedWidget, but I do not understand one of its behaviors. Here it says that only widgets that are using InheritedWidget get…
Mahdi Dahouei
  • 1,588
  • 2
  • 12
  • 32
0
votes
1 answer

Trying to make http call via VxMutation & VxState in Flutter

I'm trying to fetch banner data from JSON using HTTP.get. I did fetch the data successfully but there is something wrong which is causing this error: It shows the following error for 2 seconds and then loads images. It doesn't show the loading…