universal_io
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'
this is because path_provider does not have web support
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.
me to , any news .
You are importing the wrong dart.io on the other file. Make sure both uses the same.
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