check box flutter code example
Example 1: check if is android flutter
import 'dart:io' show Platform;
if (Platform.isAndroid) {
// Android-specific code
} else if (Platform.isIOS) {
// iOS-specific code
}
Example 2: checkbox in flutter
CheckboxListTile(
title: Text("title text"),
value: checkedValue,
onChanged: (newValue) {
setState(() {
checkedValue = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading, // <-- leading Checkbox
)
Example 3: flutter checkbox
bool _value = true;
Checkbox(
value: _value,
onChanged: (bool newValue) {
setState(() {
_value = newValue;
});
},
)
Example 4: check button flutter
// Please format your code
CheckboxListTile _ = CheckboxListTile(
title: const Text("title text"),
value: checkedValue,
onChanged: (newValue) {
setState(() {
checkedValue = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading, // <-- leading Checkbox
);