import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:getx/controller.dart'; void main() { runApp(GetMaterialApp( home: Home(), )); } class Home extends StatelessWidget { const Home({Key key}) : super(key: key); @override Widget build(BuildContext context) { final controller = Get.put(Controller()); return Scaffold( appBar: AppBar( title: Text('GetX Demo'), centerTitle: true, ), body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ GestureDetector( onTap: () { Get.to(Other()); }, child: Container( height: 200, width: 200, color: Colors.red, child: Align( alignment: Alignment.bottomCenter, child: Obx(() => Text( controller.count.toString(), style: TextStyle(fontSize: 50, color: Colors.white), )), ), ), ) ], ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () { controller.increment(); },),); }} Class Other extends StatelessWidget {// You can tell Get to find a Controller that is being used by another page and return it to you. final Controller c = Get.find(); @override Widget build(context) {// Access the updated count variable return Scaffold(appBar: appBar (leading: GestureDetector(onTap: () { Get.back(); }, child: Icon(Icons.arrow_back), ), ), body: Center(child: Text("${c.count}"))); }}Copy the code

A complete video tutorial check www.bilibili.com/video/BV1e5…