Каждый раз, когда я пытаюсь загрузить изображения, возникает эта проблема
D / EGL_emulation (8015): eglMakeCurrent: 0x99308a80: версия 2 0 (tinfo 0x99363720) D / EGL_emulation (8015): eglMakeCurrent: 0x9d885de0: 2 0 (tinfo 0x890c6560) D / EGL_emulation (8015): eglMakeCurrent: 0x99308a80: ver 2 0 (tinfo 0x99363720) D / NetworkSecurityConfig (8015): не указан параметр сетевой безопасности, используется I / flutter платформы по умолчанию (8015): URL-адрес изображения по умолчанию (url = изображение https://firebasestorage.googleapis.com/v0/b/blogapp-565dd.appspot.com/o/Post%20Images%2F2020-04-19%2007%3A34%3A50.486121.jpg?alt=media&token=f14856a9-e97d-4fc9-9236-ac8d88162b31
Это код, пожалуйста, помогите
`
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:intl/intl.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'HomePage.dart';
class UploadPhotoPage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return _UploadPhotoPageState();
}
}
class _UploadPhotoPageState extends State<UploadPhotoPage>{
File sampleImage;
String _myvalue;
String url;
final formKey = new GlobalKey<FormState>();
Future getImage() async{
var temImage = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() {
sampleImage = temImage;
});
}
bool validateAndSave (){
final form = formKey.currentState;
if(form.validate()){
form.save();
return true;
}
else{
return false;
}
}
void uploadStatusImage() async{
if(validateAndSave()){
final StorageReference postImageRef = FirebaseStorage.instance.ref().child("Post Images");
var timeKey= new DateTime.now();
final StorageUploadTask uploadTask = postImageRef.child(timeKey.toString()+".jpg").putFile(sampleImage);
var ImageUrl = await (await uploadTask.onComplete).ref.getDownloadURL();
url=ImageUrl.toString();
print("Image url = " +url);
goToHomePage();
saveToDatabase(url);
}
}
void saveToDatabase(url){
var dbTimeKey= new DateTime.now();
var formatDate= new DateFormat('MMM d, yyyy');
var formatTime= new DateFormat('EEEE, hh:mm aaa');
String date = formatDate.format(dbTimeKey);
String time = formatTime.format(dbTimeKey);
DatabaseReference ref= FirebaseDatabase.instance.reference();
var data={
"image": url,
"description": _myvalue,
"date": date,
"time": time,
};
ref.child("Posts").push().set(data);
}
void goToHomePage(){
Navigator.push
(
context, MaterialPageRoute(builder: (context){
return new HomePage();
}
)
);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: new AppBar(
title:new Text("Upload Image"),
centerTitle: true,
),
body: new Center(
child: sampleImage==null? Text("select an image "): enableUpload(),
),
floatingActionButton: FloatingActionButton(
onPressed: getImage,
tooltip: 'Add image',
child: new Icon(Icons.add_a_photo),
),
);
}
Widget enableUpload(){
return Container(
child: new Form(
key: formKey,
child: SingleChildScrollView(
child: Column(
children:<Widget>[
Image.file(sampleImage,height: 330.0,width:660.0),
SizedBox(height:15.0),
RaisedButton(
elevation: 10.0,
child: Text("Add a New Post"),
textColor: Colors.white,
color: Colors.pink,
onPressed: uploadStatusImage,
),
TextFormField(
decoration: new InputDecoration(labelText:'Description'),
validator: (value){
return value.isEmpty? 'Blog Description is required': null;
},
onSaved: (Value){
return _myvalue =Value;
},
)
]
),
),
),
);
}
}`