afterLaunch method

Future<void> afterLaunch({
  1. Duration within = const Duration(seconds: 8),
})

Keeps looking for a while after launch: Flutter can find the VM service before iOS shows the prompt.

Implementation

Future<void> afterLaunch({Duration within = const Duration(seconds: 8)}) async {
  final until = DateTime.now().add(within);
  while (answered == null && DateTime.now().isBefore(until)) {
    answered = await answerPhonePrompt(_hid, udid, question: _question, button: 'Allow');
    if (answered == null) await Future<void>.delayed(const Duration(milliseconds: 1500));
  }
}