|
@@ -16,4 +16,36 @@ class Routes {
|
|
|
GetPage(
|
|
|
name: second, page: () => const SecondView(), binding: SecondBinding())
|
|
|
];
|
|
|
+
|
|
|
+ static Future<T> push<T>(String routeName, {params}) async {
|
|
|
+ Map<String, dynamic> map = {};
|
|
|
+ map.putIfAbsent("obj", () => params);
|
|
|
+ return await Get.toNamed(routeName, arguments: map);
|
|
|
+ }
|
|
|
+
|
|
|
+ static Future<T> replacePush<T>(String routeName, {params}) async {
|
|
|
+ Map<String, dynamic> map = {};
|
|
|
+ map.putIfAbsent("obj", () => params);
|
|
|
+ return await Get.offNamed(routeName, arguments: map);
|
|
|
+ }
|
|
|
+
|
|
|
+ static Future<T> off<T>(String routeName, {params}) async {
|
|
|
+ Map<String, dynamic> map = {};
|
|
|
+ map.putIfAbsent("obj", () => params);
|
|
|
+ return await Get.off(routeName, arguments: map);
|
|
|
+ }
|
|
|
+
|
|
|
+ static Future<T> replaceAllPush<T>(String routeName, {params}) async {
|
|
|
+ Map<String, dynamic> map = {};
|
|
|
+ map.putIfAbsent("obj", () => params);
|
|
|
+ return await Get.offAllNamed(routeName, arguments: map);
|
|
|
+ }
|
|
|
+
|
|
|
+ static pop<T>({result}) {
|
|
|
+ return Get.back(result: result);
|
|
|
+ }
|
|
|
+
|
|
|
+ static getParams<T>() {
|
|
|
+ return Get.arguments == null ? null : Get.arguments['obj'];
|
|
|
+ }
|
|
|
}
|