Skip to main content

avoid-getx-rx-inside-build

added in: 1.10.0
Pro+

Warns when GetX Rx primitives are instantiated inside the build method.

Example

❌ Bad:

class _SomeState extends State<Some> {

Widget build(BuildContext context) {
final count = 0.obs; // LINT

...
}
}

✅ Good:

class _SomeState extends State<Some> {
final count = 0.obs;


Widget build(BuildContext context) {
...
}
}