Search code examples
flutterdartflutter-dependenciesflutter-webflutter-test

Why do we put "e" in our catch argument, in Flutter/Dart?


For instance:

try{

Parser p = Parser();  
    Expression exp = p.parse(expression);
    ContextModel cm = ContextModel();
      evaluated = exp.evaluate(EvaluationType.REAL, cm);
      result = '$evaluated'; 

}

catch(e)

{

result = "no";

}

I see a lot of flutter related youtube tutorials simply putting "e" as their argument in the catch. Why do we do this? Does e simply mean any type of error?


Solution

  • No there is no special meaning, e is used as a placeholder. You can actually put any letter or allowed symbol like (_), and it will still represent the exception type incoming when error is thrown.