mobile_skt/lib/router/auth_middleware.dart

20 lines
529 B
Dart
Raw Normal View History

2024-10-16 09:48:17 +08:00
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/store/resource.store.dart';
import 'package:sk_base_mobile/util/util.dart';
class AuthMiddleware extends GetMiddleware {
@override
RouteSettings? redirect(String? route) {
bool isExsited = ResourceService.to.resources
.firstWhereOrNull((element) => element.path == route) !=
null;
if (!isExsited) {
SnackBarUtil().info('您没有权限');
return null;
}
return null;
}
}