Reputation: 1746
I just upgraded to latest flutter version 2.2, and now this piece of code is not working.
import 'dart:io'; //this line is greyed out now
.
.
file = File("${dir.path}/file.pdf"); //error: Abstract classes can't be instantiated.
I checked the release notes, and could not locate any breaking changes regarding this. The Documentaion shows the File class as abstract, and still the example says:
var myFile = File('file.txt');
What should be the alternative to replace this line?
Upvotes: 0
Views: 609
Reputation: 604
Check for other imports using File
class. You can use alias if its necessary.
Upvotes: 1
Reputation: 1746
The issue was with flutter_cache_manager plugin, which I was importing as
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
So I replaced it with
import 'package:flutter_cache_manager/flutter_cache_manager.dart' as FCM;
(Internally this plugin has a line saying:
export 'package:file/file.dart' show File;
) that caused the issue.
Upvotes: 0