Passing the controller as a parameter and update it's value #1911
Unanswered
asadamatic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I'm working on a package that allows users to pick files and show a list of selected files in a widget. I want that user should be able to access those files in the widget that
File
widget that my package provides.The flow of package usage,
final _firstController = FileController();
File
widget and a corresponding 'FileUploadIconButtonto you're widget tree and pass this controller to
Fileand 'FileUploadIconButton
widget.I'm using the
tag
to differentiate between multiple instances of the controller.The code for
File
widget.Code for 'FileUploadIconButton`
The file selection is working well and the two instances are separated as required.
Requirement
I want to use the controllers initiated inside the
Home
widget and passed to the package widgets and access the selected files, and currently, the_firstController.files
in theHome
is empty because it is not updated like theObx
widget inside theFileHolder
widget. Since the user should be able to use theFileHolder
widget without having to use theGet
package, so please help me figure out a way to update the controller that was passed from outside the package.Beta Was this translation helpful? Give feedback.
All reactions