PreviewApp.preview constructor
PreviewApp.preview({
- Key? key,
- required List<
PreviewProvider> providers()?, - required String paramsJson,
Implementation
PreviewApp.preview({
Key? key,
required this.providers,
required String paramsJson,
}) : params = PreviewAppParams.fromJson(jsonDecode(paramsJson))!,
super(key: key) {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (FlutterErrorDetails details) {
// this line prints the default flutter gesture caught exception in console
// but this won't be visible of course, when running with 'flutter run'
FlutterError.dumpErrorToConsole(details);
trySendError(
clientId: params.clientId,
port: params.kotlinServerPort,
previewId: params.previewId,
error: details,
).then((success) {
if (!success) {
print("Error while trying to send error");
print("----------------------");
print("Original error : ${details.exception}");
print("StackTrace : ${details.stack}");
}
});
};
}