in lib/playground.dart [713:764]
void _showGist(String gistId) {
if (_gistIdInProgress == gistId) {
return;
}
// Don't auto-run if we're re-loading some unsaved edits; the gist might
// have halting issues (#384).
var loadedFromSaved = false;
// When sharing, we have to pipe the returned (created) gist through the
// routing library to update the url properly.
final overrideNextRouteGist = _overrideNextRouteGist;
if (overrideNextRouteGist != null && overrideNextRouteGist.id == gistId) {
_editableGist.setBackingGist(overrideNextRouteGist);
_overrideNextRouteGist = null;
return;
}
_overrideNextRouteGist = null;
_gistIdInProgress = gistId;
gistLoader.loadGist(gistId).then((Gist gist) {
_editableGist.setBackingGist(gist);
if (_gistStorage.hasStoredGist && _gistStorage.storedId == gistId) {
loadedFromSaved = true;
final storedGist = _gistStorage.getStoredGist()!;
_editableGist.description = storedGist.description;
for (final file in storedGist.files) {
_editableGist.getGistFile(file.name).content = file.content;
}
}
clearOutput();
// Analyze and run it.
Timer.run(() {
performAnalysis().then((bool result) {
// Only auto-run if the static analysis comes back clean.
if (result && !loadedFromSaved) {
handleRun();
}
}).catchError((e) => null);
});
}).catchError((e) {
final message = 'Error loading gist $gistId.';
showSnackbar(message);
_logger.severe('$message: $e');
}).whenComplete(() {
_gistIdInProgress = null;
});
}