universal_io icon indicating copy to clipboard operation
universal_io copied to clipboard

A value of type 'Directory/*1*/' can't be assigned to a variable of type 'Directory/*2*/'. - 'Directory/*1*/' is from 'dart:io'. - 'Directory/*2*/' is from 'package:universal_io/src/io/directory.dart'

Open amirsuwal01 opened this issue 3 years ago • 5 comments

amirsuwal01 avatar Feb 16 '22 06:02 amirsuwal01

this is because path_provider does not have web support

misterpropik avatar Feb 24 '22 13:02 misterpropik

this is because path_provider does not have web support

Don't think that is specific to the path_provider. Any API from a plugin declaring dependency on the File or Directory from the dart:io will choke when you try to pass values from univeral_io to them or try to assign values returned from such API to the variables typed from the universal_io.

E.g. in case of the path_provider, a workaround for non-web platforms is like:

Directory dir = Directory('${(await getApplicationSupportDirectory()).path}')

Though I wasn't been able to find a way to create a Directory instance on the web platform and would appreciate any help with that.

ekuleshov avatar Mar 04 '22 13:03 ekuleshov

me to , any news .

Joseph-Nathan avatar Mar 25 '22 14:03 Joseph-Nathan

You are importing the wrong dart.io on the other file. Make sure both uses the same.

tanjunior avatar May 11 '22 03:05 tanjunior

You are importing the wrong dart.io on the other file. Make sure both uses the same.

You can't make sure "both uses the same" when one of those imports is coming from some dependent 3rd party package that is not using the universal_io

ekuleshov avatar May 11 '22 03:05 ekuleshov