concept error in category flutter

This is an excerpt from Manning's book Flutter in Action.
The JavaScript bridge is a marvel of modern programming, to be sure, but it presents two big problems. First, debugging is hard. When there’s an error in the runtime compiler, that error has to be traced back across the JavaScript bridge and found in the JavaScript code. The second issue is performance. The JavaScript bridge is expensive: each time a button in the app is tapped, that event must be sent across the bridge to your JavaScript app. The result, for lack of better term, is jank.
Catching errors in async code is important. Consider this: you have an async function that calls out to an API, but that API’s server is down. You don’t want your app to crash because it’s relying on specific data—you want to fail gracefully. You can catch errors with async code in two ways, so you can handle errors or failed network calls without disrupting the user experience.
The first way to catch errors is used with plain ol’ future types. There’s a method called catchError for this, as shown in the following listing.
Listing 9.5. The catchError method
Future futrePrint(Duration dur, String msg) async { return Future.delayed(dur).then((onValue) => msg); } main() { futrePrint(Duration(milliseconds: 2), "D") .then((status) => print(status)) .catchError((err) => print(err)); #1 }Just like async and await make writing async code clearer than Future objects, there’s also a nicer way to catch errors: the try/catch block, which is common across many languages. Let’s look at that next.