onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() {
WidgetsBinding.instance.addPersistentFrameCallback((_) {
// print(_navService.finalRoutes);
_addRoutes(_navService.rawFooterRoutes);
_addRoutes(_navService.finalRoutes);
});
isScreenLoading(true);
focusNode = FocusNode();
expansionController = AnimationController(
vsync: this,
duration: 250.milliseconds,
value: 1.0,
);
ever(currentRoute, (String location) {
String _location = location.split('/').last.toLowerCase();
if (_location.isEmpty || _location == 'dashboard') {
currentPageTitle(_navService.rawRoutes.first.title);
} else {
// print(_location);
// print(finalRoutes);
// print(finalRoutes);
// print(finalRoutes.entries.map((element) =>
// _location == element.value.page?.name.split('/').last));
// print(finalRoutes.values.where((FlutterDashboardItem element) =>
// _location.contains('${element.page?.name.split('/').last}')));
WidgetsBinding.instance.addPersistentFrameCallback((_) {
if (finalRoutes.values
.where((FlutterDashboardItem element) =>
_location.contains('${element.page?.name.split('/').last}'))
.isNotEmpty) {
// if (finalRoutes.entries
// .where((element) =>
// _location == element.value.page?.name.split('/').last)
// .isNotEmpty) {
// currentPageTitle(finalRoutes.entries
// .singleWhere((element) =>
// _location == element.value.page?.name.split('/').last)
// .key);
// } else {
// currentPageTitle("404");
// delegate?.toNamed(DashboardRoutes.ERROR404);
// }
currentPageTitle(finalRoutes.values
.singleWhere((FlutterDashboardItem element) =>
_location.contains('${element.page?.name.split('/').last}'))
.title);
} else {
currentPageTitle("404");
delegate?.toNamed(DashboardRoutes.ERROR404);
}
});
// Get.log('Current dashboard route : ${currentPageTitle.value}');
}
});
super.onInit();
}