When i study they said stateless widget can change value in short static value only display, but when i try to use getx in stateless it can change the value dynamic getx.dart file and testingGetX.dart
`import 'package:get/get.dart';
class GetX{
RxInt number = 0.obs;
void increase() {
number = number + 1;
}
}`
`import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_api_2/getX.dart';
class TestingGetX extends StatelessWidget {
const TestingGetX({super.key});
@override
Widget build(BuildContext context) {
final authProvider c = Get.put(authProvider());
return Scaffold(
appBar: AppBar(),
body:Column(
children:
[
Text("value : ${c.number}"),
Obx(()=>Text("value : ${c.number}")),
TextButton(onPressed: () {
c.number = c.number+1;
}, child: Text("increase"))
]
),
);
}
}`
It is not your stateless widget that is changing the state, it is the getX observer that is doing it. The state of the parent widget is always the same, only what is inside obx() is rebuilt