This is my Flutter app.
<code>void main() {
Future.delayed(Duration.zero, () {
throw "boom";
});
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
}
</code>
<code>void main() {
Future.delayed(Duration.zero, () {
throw "boom";
});
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
}
</code>
void main() {
Future.delayed(Duration.zero, () {
throw "boom";
});
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
}
This does not show “boom” nor the correct log trace. Debugging is now a hell.
<code>errors.dart:296 Uncaught (in promise) Error
at Object.throw_ [as throw] (errors.dart:296:3)
at main.dart:643:5
at future.dart:423:39
at internalCallback (isolate_helper.dart:48:11)
throw_ @ errors.dart:296
(anonymous) @ main.dart:643
(anonymous) @ future.dart:423
internalCallback @ isolate_helper.dart:48
Promise.then (async)
</code>
<code>errors.dart:296 Uncaught (in promise) Error
at Object.throw_ [as throw] (errors.dart:296:3)
at main.dart:643:5
at future.dart:423:39
at internalCallback (isolate_helper.dart:48:11)
throw_ @ errors.dart:296
(anonymous) @ main.dart:643
(anonymous) @ future.dart:423
internalCallback @ isolate_helper.dart:48
Promise.then (async)
</code>
errors.dart:296 Uncaught (in promise) Error
at Object.throw_ [as throw] (errors.dart:296:3)
at main.dart:643:5
at future.dart:423:39
at internalCallback (isolate_helper.dart:48:11)
throw_ @ errors.dart:296
(anonymous) @ main.dart:643
(anonymous) @ future.dart:423
internalCallback @ isolate_helper.dart:48
Promise.then (async)
What is the latest Flutter Version that does not have this issue? I cannot downgrade too much.
My current version is:
<code> Flutter (Channel stable, 3.22.2, on macOS 14.0 23A344 darwin-arm64, locale en-US)
</code>
<code> Flutter (Channel stable, 3.22.2, on macOS 14.0 23A344 darwin-arm64, locale en-US)
</code>
Flutter (Channel stable, 3.22.2, on macOS 14.0 23A344 darwin-arm64, locale en-US)
I know there is a open Github issue for it, but as a general question, when this kind of blocker issue happen, how to quickly and efficiently make informed decision on which most recent past version to downgrade to ?
7
Try this:
<code>import 'dart:async';
import 'package:flutter/material.dart';
void main() {
// Run the app inside a custom Zone to catch asynchronous errors
runZonedGuarded(() {
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
Future.delayed(Duration.zero, () {
throw "TEST: boom";
});
}, (error, stackTrace) {
// Print the error
print('Caught by zone: $error');
});
}
</code>
<code>import 'dart:async';
import 'package:flutter/material.dart';
void main() {
// Run the app inside a custom Zone to catch asynchronous errors
runZonedGuarded(() {
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
Future.delayed(Duration.zero, () {
throw "TEST: boom";
});
}, (error, stackTrace) {
// Print the error
print('Caught by zone: $error');
});
}
</code>
import 'dart:async';
import 'package:flutter/material.dart';
void main() {
// Run the app inside a custom Zone to catch asynchronous errors
runZonedGuarded(() {
runApp(MaterialApp(home: Scaffold(body: Center(child: Text("Hello")))));
Future.delayed(Duration.zero, () {
throw "TEST: boom";
});
}, (error, stackTrace) {
// Print the error
print('Caught by zone: $error');
});
}
//Also, you can throw error below or above the runApp;