Convert the then chain to async-await for better readability and context safety.
Add a StatefulWidget and use if (!mounted) return; before using context.
Example:
final profile = await apiService.checkOTP(_emailController.text, s);
if (profile != null) {
  if (!mounted) return;
  Navigator.push(context, MaterialPageRoute(...));
}
final profile = await apiService.checkOTP(_emailController.text, s);
if (profile != null) {
  if (!mounted) return;
  Navigator.push(context, MaterialPageRoute(...));
}