handleEventLoopCallback method
Implementation
Future<bool> handleEventLoopCallback() async {
if (_taskQueue.isEmpty) return false;
final TaskEntry<dynamic> entry = _taskQueue.first;
if (schedulingStrategy(
priority: entry.priority, scheduler: SchedulerBinding.instance)) {
try {
_taskQueue.removeFirst();
entry.run();
} catch (exception, exceptionStack) {
StackTrace? callbackStack;
assert(() {
callbackStack = entry.debugStack;
return true;
}());
FlutterError.reportError(FlutterErrorDetails(
exception: exception,
stack: exceptionStack,
library: 'scheduler library',
context: ErrorDescription('during a task callback'),
informationCollector: (callbackStack == null)
? null
: () sync* {
yield DiagnosticsStackTrace(
'\nThis exception was thrown in the context of a scheduler callback. '
'When the scheduler callback was _registered_ (as opposed to when the '
'exception was thrown), this was the stack',
callbackStack,
);
},
));
}
return _taskQueue.isNotEmpty;
}
return true;
}