ethanblake4 / flutter_eval

Code push for Flutter, powered by dart_eval

Home Page:https://pub.dev/packages/flutter_eval

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Catching error

yakppal opened this issue · comments

commented

It would be nice if we can catch error from EvalWidget/CompileWidget. If there's an error, I can show the syntax error on screen. Is there any other way to detect compile error?

commented
@override
  Widget build(BuildContext context) {
    try {
      return EvalWidget();
    } catch (e) {
      return Text(e.message);
    }
  }

Screenshot 2023-03-11 at 7 35 41 AM

It would something like this. I need to show the errors of the code.

commented

Completed in v0.6.0. There is a new onError property in EvalWidget (and RuntimeWidget / CompilerWidget) you can use to create a custom error display.