recordThrowIfError method
Records thrownStackTrace if this is the first throw of an instance extending Error; a later throw keeps the first, as Dart does.
Implementation
void recordThrowIfError(StackTrace stackTrace) {
if (_bridgedSuperObject is Error) thrownStackTrace ??= stackTrace;
}