zdsFileError function

void zdsFileError(
  1. BuildContext context,
  2. FilePickerConfig config,
  3. Exception exception
)

Default error handler

Implementation

void zdsFileError(BuildContext context, FilePickerConfig config, Exception exception) {
  String message(Exception exception) {
    if (exception is FilePickerException) {
      return exception.type.message(context, args: exception.args);
    } else {
      return ComponentStrings.of(context).get('FILE_COMPRESSING_ER', 'An error occurred while compressing a file.');
    }
  }

  ScaffoldMessenger.of(context).showZdsToast(
    padding: const EdgeInsets.all(16).copyWith(top: 0),
    ZdsToast(
      multiLine: true,
      title: Text(message(exception)),
      leading: const Icon(ZdsIcons.close_circle),
      color: ZdsToastColors.error,
    ),
  );
}