[web][upstream] Fix debugPrintStack for web platform (#37638)
* [web][upstream] Fix debugPrintStack for web platform Fixes: https://github.com/flutter/flutter/issues/37488
This commit is contained in:
parent
626ca086d0
commit
920961abc8
@ -750,6 +750,12 @@ void debugPrintStack({ String label, int maxFrames }) {
|
||||
if (label != null)
|
||||
debugPrint(label);
|
||||
Iterable<String> lines = StackTrace.current.toString().trimRight().split('\n');
|
||||
if (kIsWeb) {
|
||||
// Remove extra call to StackTrace.current for web platform.
|
||||
// TODO(ferhat): remove when https://github.com/flutter/flutter/issues/37635
|
||||
// is addressed.
|
||||
lines = lines.skip(1);
|
||||
}
|
||||
if (maxFrames != null)
|
||||
lines = lines.take(maxFrames);
|
||||
debugPrint(FlutterError.defaultStackFilter(lines).join('\n'));
|
||||
|
@ -14,7 +14,7 @@ void main() {
|
||||
});
|
||||
expect(log[0], contains('Example label'));
|
||||
expect(log[1], contains('debugPrintStack'));
|
||||
}, skip: isBrowser);
|
||||
});
|
||||
|
||||
test('debugPrintStack', () {
|
||||
final List<String> log = captureOutput(() {
|
||||
@ -39,7 +39,7 @@ void main() {
|
||||
|
||||
expect(joined, contains('captureOutput'));
|
||||
expect(joined, contains('\nExample information\n'));
|
||||
}, skip: isBrowser);
|
||||
});
|
||||
|
||||
test('FlutterErrorDetails.toString', () {
|
||||
expect(
|
||||
|
Loading…
x
Reference in New Issue
Block a user