setFromPath method

Future<void> setFromPath({
  1. required String path,
})

This dont work in web!

Implementation

Future<void> setFromPath({required String path}) 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).then((r) {
        _file     = r.platformFile;
        _bytes    = _file?.bytes;
        _error    = r.error;
        _hasImage = !r.error;
        notifyListeners();
      });
    } catch (e){
      debugPrint('n_image_piker e1: $e');
      _reset(error: true);
      notifyListeners();
    }
  }
}