setFromResponse method

Future<void> setFromResponse(
  1. Response r,
  2. String n
)

Implementation

Future<void> setFromResponse(Response r, String n) async {
  try{
    if(kIsWeb){
      await setFile(r, n, _imageKey, headers).then((r) {
        _file   = r.platformFile;
        _error  = r.error;
        notifyListeners();
      });
    } else {
      await setFile(r, n, _imageKey, headers).then((r) {
        _file     = r.platformFile;
        _error    = r.error;
        _hasImage = !r.error;
        notifyListeners();
      });
    }
  } catch (e){
    debugPrint('n_image_piker e1: $e');
    _error    = true;
    _hasImage = false;
    notifyListeners();
  }
}