Verifies that there are no guarded methods currently pending (see guard).
This is used at the end of tests to ensure that nothing leaks out of the test.
Source
static void verifyAllScopesClosed() { if (_scopeStack.isNotEmpty) { StringBuffer message = new StringBuffer(); message.writeln('Asynchronous call to guarded function leaked. You must use "await" with all Future-returning test APIs.'); for (_AsyncScope scope in _scopeStack) { final _StackEntry guarder = _findResponsibleMethod(scope.creationStack, 'guard', message); if (guarder != null) { message.writeln( 'The guarded method "${guarder.methodName}" ' '${guarder.className != null ? "from class ${guarder.className} " : ""}' 'was called from ${guarder.callerFile} ' 'on line ${guarder.callerLine}, ' 'but never completed before its parent scope closed.' ); } } throw new FlutterError(message.toString().trimRight()); } }