Amar Dahake
2 min readFeb 18, 2020

Error handling in Flutter

Dart support exception throwing and catching, we used try catch for error handling like classic error handling

Future builder catches error, it has hasError field to handle errors, it catches every types of exception snapshot.error to find what types of exception throw

throw custom exception message and catch and rethrow exception to display message in FutureBuilder

Create custom exception type in dart we can throw any type of object

Using ChangeNotifier when you catch error or throws error change the state variable to notifiey it is error

Handle error using functional programming in dart

Return either failure or post

Amar Dahake

I'm entrepreneur who loves code, travel and food • Productivity Expert • Product Management • Software Architect • Clean architecture , DDD with TDD, BDD, EDD