[英]The name 'File' is defined in the libraries 'dart:html' and 'dart:io'
Does anybody know how to solve this error here's my code and the imports the error is in the "File" the error is as follows:有谁知道如何解决这个错误,这是我的代码,导入错误在“文件”中,错误如下:
The name 'File' is defined in the libraries 'dart:html' and 'dart:io'.名称 'File' 在库 'dart:html' 和 'dart:io' 中定义。
@override
State createState() => ChatScreenState(receiverId: receiverId, receiverAvatar: receiverAvatar);
}
class ChatScreenState extends State<ChatScreen>
{
final String receiverId;
final String receiverAvatar;
ChatScreenState({
Key key,
@required this.receiverId,
@required this.receiverAvatar,
});
final TextEditingController textEditingController = TextEditingController();
final ScrollController listScrollController = ScrollController();
final FocusNode focusNode = FocusNode();
bool isDisplaySticker;
bool isLoading;
File imageFile;
String imageUrl;
String chatId;
SharedPreferences preferences;
String id;
var listMessage;
@override
void initState() {
// TODO: implement initState
super.initState();
focusNode.addListener(onFocusChange);
isDisplaySticker = false;
isLoading = false;
chatId = "";
readLocal();
}
I also imported this我也导入了这个
import 'dart:async';
import 'dart:html';
import 'dart:io';
import 'package:file/file.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:telegramchatapp/Widgets/FullImageWidget.dart';
import 'package:telegramchatapp/Widgets/ProgressWidget.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
Please check you need dart.html
or not.请检查您是否需要dart.html
。 If you need both packages, you can use a typecast operator as
.如果您需要这两个包,则可以使用类型转换运算符as
。
//import
import 'dart:io' as io;
import 'dart:html';
//Usage
io.File imageFile;
File htmlFile;
You just need to remove the unneeded import files, which will be shown with a blue underline.您只需要删除不需要的导入文件,这些文件将显示为蓝色下划线。 Thanks.谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.