jonataslaw / jonataslaw/getx

Get.rawRoute is null when i use Get.offAllToNamed

Open
#1,237 2 comments 1 reaction 1 assignee Claimed by @jonataslaw View on GitHub
Dominant language
Dart
Stars
11.2k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Get.rawRoute is null when i use Get.offAllToNamed, then i use Get.offAndToNamed It's normal.

example:

```dart
class AppLoadPage extends StatefulWidget {
@override
_AppLoadState createState() => _AppLoadState();
}

class _AppLoadState extends State {
@override
void initState() {
super.initState();

WidgetsBinding.instance.addPostFrameCallback((_) {
_initApplication();
});
}

void _initApplication() async {
bool isLogin = true;
Get.offAllToNamed(isLogin ? Routes.HOME : Routes.LOGIN);
// Get.offAndToNamed(isLogin ? Routes.HOME : Routes.LOGIN); // is ok
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container( ),
);
}
}
```
```dart
class IndexLogic extends GetxController {
@override
void onInit() {
super.onInit();
print(Get.rawRoute); // null
print(ModalRoute.of(Get.context)); // null
}
}

class IndexPage extends StatelessWidget {
final IndexLogic logic = Get.find();

@override
Widget build(BuildContext context) {
return Scaffold(
body: Container( ),
);
}
}
```

**Flutter Version:**
1.22.3

**Getx Version:**
3.25.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.