onReady method
Called 1 frame after onInit(). It is the perfect place to enter navigation events, like snackbar, dialogs, or a new route, or async request.
Implementation
@override
void onReady() async {
if (cameras.isEmpty) {
status.value = BaseStatus(
message: 'No camera found',
state: AppState.pop,
);
}
super.onReady();
if (argument?.longShotImages != null) {
longShotImages.assignAll(
argument!.longShotImages!
.map((e) => e.imageUrl ?? e.url ?? '')
.toList(),
);
}
if (argument?.middleShotImages != null) {
middleShotImages.assignAll(
argument!.middleShotImages!
.map((e) => e.imageUrl ?? e.url ?? '')
.toList(),
);
}
if (argument?.closeUpShotImages != null) {
closeUpShotImages.assignAll(
argument!.closeUpShotImages!
.map((e) => e.imageUrl ?? e.url ?? '')
.toList(),
);
}
if (argument?.carPartHasDamage != null &&
argument!.carPartHasDamage!.isNotEmpty) {
carPartsForCloseUpShot.value.assignAll(argument!.carPartHasDamage!);
carPartOnSelected.value = carPartsForCloseUpShot.value.first;
}
if (argument?.oldImageId != null) {
currentReplacedImageId.value = argument!.oldImageId ?? '';
}
if (argument?.initPositionIndex != null) {
onTabChanged(argument!.initPositionIndex!);
}
final currentPos = await LocationServices.getLocation();
currentLocation = await LocationServices.getLocationInfo(
currentPos?.latitude,
currentPos?.longitude,
);
}