-
- import 'package:flutter/scheduler.dart';
- import 'package:get/get.dart';
- import 'package:get_storage/get_storage.dart';
-
- void routingCallback (routing) {
- GetStorage box = GetStorage();
- bool isLogin = box.hasData('token');
- bool isSplashScreen = routing?.current == '/splash';
- bool isLoginPage = routing?.current == '/login';
- if (!isLogin && !isSplashScreen && !isLoginPage) {
-
-
- SchedulerBinding.instance?.addPostFrameCallback((_) => Get.offNamed('/login'));
- }
- }
|