localizePlatformError property

(String Function(BuildContext context, PlatformException exception)?) localizePlatformError
getter/setter pair

A way to customize error message for PlatformException

Example usage:

ErrorText.localizePlatformError = (BuildContext context, PlatformException e) {
  if (e.code == "network_error") return "Please check your internet connection.";
  return "Oh no! Something went wrong.";
}

Implementation

static String Function(
  BuildContext context,
  PlatformException exception,
)? localizePlatformError;