Prerequisites
- A working Flutter quickstart
- An active effect package that declares runtime parameters
Read the authored controls
Query parameters after the package has applied:
final nosmai = NosmaiFlutter.instance;
final parameters = await nosmai.getEffectParameters();
for (final parameter in parameters) {
debugPrint('${parameter.displayName} (${parameter.type}) '
'= ${parameter.currentValue}');
}
Each FilterParameter provides its authored name, type, current and default values, optional range, option list, display name, and description. Rebuild the controls when the active package changes.
Update a value
Use a name returned by the active package:
final updated = await nosmai.setEffectParameter( 'AUTHORED_PARAMETER_NAME', 0.5, ); final textUpdated = await nosmai.setEffectParameterString( 'AUTHORED_TEXT_PARAMETER_NAME', 'Hello', );
For a slider, use minValue and maxValue when hasRange is true. Debounce very high-rate UI input and ignore late Futures after the widget is disposed.
Verify the update
Call getEffectParameterValue for a numeric control and compare the result with the requested value. The processed preview should change without rebuilding NosmaiCameraPreview or reapplying the package.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| The parameter list is empty | The active package exposes no runtime controls | Wait for successful package application and handle an empty list normally |
The setter returns false | The name or setter type does not match the metadata | Use the exact name and numeric or string method declared for it |
| A stale update changes a new package | An old slider Future completed after the active package changed | Cancel or invalidate pending UI updates when selecting another package |