Baseflow / flutter_cache_manager

Generic cache manager for flutter
https://baseflow.com
MIT License
739 stars 426 forks source link

File in flutter_cache_manage conflict with File in dart.io #320

Closed aideric closed 3 years ago

aideric commented 3 years ago

🔙 Regression

File in flutter_cache_manage conflict with File in dart.io

Old (and correct) behavior

can import both import 'dart:io'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; in same file

Current behavior

seems File in 'dart:io' override by File in flutter_cache_manager

Reproduction steps

final ImagePicker imagePicker = ImagePicker();
          final PickedFile? pickedFile = await imagePicker.getImage(source: ImageSource.gallery);
          if (pickedFile != null) {
            final File file = File(pickedFile.path);
            setState(() {
              this.image = file;
            });
          }

Configuration

Version: 3.1.0

Platform:

sidrao2006 commented 3 years ago

If you are using File with this library , you should use the type exported by the package. If you want to use File with this package and with some some custom code, for which you need to import dart:io, you could import the libraries using aliases

import 'dart:io' as io;

Or something like this with flutter_cache_manager

akadatsky commented 3 years ago

Faced with the same issue with library pdf_flutter. It has 2 imports:

import 'dart:io';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';

And flutter_cache_manager overrides dart:io. Could you please fix it?

See also: https://stackoverflow.com/q/67784614/1159507