Example output
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class Button extends StatelessWidget {
Button({Key? key});
final count = 0.obs;
final changingText = "I will change my state now".obs;
void increment() {
count.value++;
changingText.value = "State has changed ${count.value} times";
}
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: Obx(() => Text(changingText.value)),
onPressed: increment,
);
}
}