flutter callback with parameters code example
Example 1: dart callback function with parameter
class Obj {
String Function(String, int, etc...) callbackName;
Obj(this.callbackName);
}
main() {
var myObj = Obj((String p1, int p2, etc...) {
return "$p1$p2";
});
}
Example 2: flutter pass onchanged callback in arguments
class DropdownItem extends StatelessWidget {
final Function(bool) onchangedCallback;
Checkbox(
onChanged: onchangedCallback,
),
Example 3: callback with arguments flutter
onTap: () => callback(params)