Control Object
The Control Object action allows you to programmatically control various built-in controllers and objects within your app. This enables dynamic interaction with UI components like scrollable lists, text fields, page views, timers, and more.
Note: The controller must be initialized and assigned to the target widget before this action can control it.
✅ Common Use Cases
Programmatically scrolling to a specific position in a list
Setting or clearing text in form fields
Navigating between pages in a PageView
Controlling timer operations (start, pause, reset)
Adding data to streams for reactive UI updates
Managing file operations and API cancellations
⚙️ Default Behavior
By default:
Controller Required
Action fails if the specified controller is not found in context
Method Validation
Action fails if the method doesn't exist for the controller type
Parameter Evaluation
All args expressions are evaluated before method execution
Error Handling
Throws exception if controller or method is invalid
🛠️ How to Use
Create a controller variable (e.g., Scroll Controller, Page Controller)
Assign the controller to the target widget
Add the Control Object action to an event
Set
dataTypeto reference your controller variableChoose the desired
methodfrom the available optionsProvide required
argsfor the selected method
📦 Properties
dataType
Expression
✅
Reference to the controller variable to control
method
String
✅
The method name to call on the controller
args
Object
❌
Named arguments to pass to the method
🎛️ Supported Controller Types & Methods
Scroll Controller
Controls scrolling behavior in scrollable widgets (ListView, GridView, etc.).
jumpTo
offset: number
Instantly jump to a specific scroll position
animateTo
offset: number, durationInMs?: number, curve?: string
Smoothly animate to a scroll position
Page Controller
Controls page navigation in PageView widgets.
jumpToPage
page: number
Instantly jump to a specific page
animateToPage
page: number, durationInMs?: number, curve?: string
Smoothly animate to a page
nextPage
durationInMs?: number, curve?: string
Navigate to the next page
previousPage
durationInMs?: number, curve?: string
Navigate to the previous page
Text Field Controller
Controls text input in TextFormField widgets.
setValue
text: string
Set the text content of the field
clear
-
Clear all text from the field
Timer Controller
Controls timer operations in Timer widgets.
start
-
Start the timer
resume
-
Resume a paused timer
pause
-
Pause the timer
reset
-
Reset timer to initial state
Stream Controller
Controls data flow in StreamBuilder widgets.
add
data: any
Add data to the stream
close
-
Close the stream
Async Controller
Controls async operations in FutureBuilder widgets.
invalidate
-
Invalidate cached data and trigger refresh
API Cancel Token
Controls cancellable API requests.
cancel
message?: string
Cancel the ongoing API request
File Controller
Controls file operations.
delete
-
Delete the file
Story Controller
Controls story/carousel navigation.
next
-
Move to next story item
previous
-
Move to previous story item
💡 Examples
Scroll to Top of List:
Animate to Page:
Set Text Field Value:
Dynamic Page Navigation:
Timer Control:
Stream Data Update:
🔗 Related Documentation
Variables - Controller Types - Learn about creating controller variables
Set App State - Update app state variables
Set State - Update page state variables
Building UI - Event Handlers - Connect actions to UI events
Last updated