setFromPath method

Future<void> setFromPath({
  1. required String path,
  2. int? maxSize,
})

This dont work in web!

Implementation

Future<void> setFromPath({
  required final String path,
  final int? maxSize
}) async {
  List<String> _e = path.split(".");
  if (_e.length <= 1) throw Exception("path dont have extension");

  if (kIsWeb) {
    throw Exception('This dont work in web');
  } else {
    try {
      await PlatformTools().setFileFromPath(
        path    : path,
        maxSize : maxSize
      ).then((r) {
        _file     = r.platformFile;
        _bytes    = r.platformFile.bytes;
        _error    = r.error;
        _hasImage = !r.error;
        notifyListeners();
      });
    } catch (e) {
      debugPrint('n_image_piker e1: $e');
      _reset(error: true);
      notifyListeners();
    }
  }
}