-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Issue in Display or upload image #34573
Comments
These Exceptions Are DisplayedPerforming hot restart... |
Looks like a problem with the URL you are using. |
I already change the URL but the same problem is occurring |
This is the issue which is occurred when I press the "UPDATE" Button
I/flutter ( 4677): Another exception was thrown: Exception: HTTP request failed, statusCode: 531, https://picsum.photos/414/278/
I/flutter ( 4677): Another exception was thrown: 'package:flutter/src/painting/image_provider.dart': Failed assertion: line 449 pos 16: 'url != null': is not true.
I/flutter ( 4677): Another exception was thrown: 'package:flutter/src/painting/image_provider.dart': Failed assertion: line 449 pos 16: 'url != null': is not true.
EditProfile.txt
Code
import 'dart:async';
import 'dart:convert';
import 'dart:io';
//import 'package:path_provider/path_provider.dart';
import 'package:async/async.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path/path.dart';
import 'package:rent_on_click/constunt.dart';
import 'package:http/http.dart' as http;
class EditProfile extends StatefulWidget {
@OverRide
_EditProfileState createState() => _EditProfileState();
}
class PasswordField extends StatefulWidget {
const PasswordField({
this.fieldKey,
this.hintText,
this.labelText,
this.helperText,
this.onSaved,
this.validator,
this.onFieldSubmitted,
this.enable,
this.initialvalue
});
final Key fieldKey;
final String hintText;
final String labelText;
final String helperText;
final FormFieldSetter onSaved;
final FormFieldValidator validator;
final ValueChanged onFieldSubmitted;
final bool enable;
final String initialvalue;
@OverRide
_PasswordFieldState createState() => _PasswordFieldState();
}
class _PasswordFieldState extends State {
bool _obscureText = true;
@OverRide
Widget build(BuildContext context) {
return TextFormField(
key: widget.fieldKey,
}
}
class _EditProfileState extends State {
BuildContext context;
final GlobalKey _scaffoldKey = new GlobalKey();
Size screenSize ;
File _image;
Size size;
String name,enail,password,phone_no,address,city,state;
bool _enable = true;
void showInSnackBar(String value) {
_scaffoldKey.currentState.showSnackBar(SnackBar(
content: Text(value)
));
}
bool _autovalidate = false;
bool _formWasEdited = false;
final GlobalKey _formKey = GlobalKey();
final GlobalKey<FormFieldState> _passwordFieldKey = GlobalKey<FormFieldState>();
void _handleSubmitted() {
final FormState form = _formKey.currentState;
if (!form.validate()) {
_autovalidate = true; // Start validating on every change.
showInSnackBar('Please fix the errors in red before submitting.');
} else {
form.save();
debugPrint(name+"////"+enail+"/////"+password+"////"+phone_no+"//////"+address+"/////"+city+"////"+state);
var mapp={
'name':name,
'email':enail,
'password':password,
'contact_no':phone_no,
'address':address,
'city':city,
'state':state,
'id':constant.u_id,
}
String validateName(String value) {
if (value.isEmpty) return 'Name is required.';
final RegExp nameExp = new RegExp(r'^[A-za-z ]+$');
if (!nameExp.hasMatch(value))
return 'Please enter only alphabetical characters.';
return null;
}
String validateEmail(String value) {
if (value.isEmpty) return 'Email is required.';
final RegExp nameExp = new RegExp(r'^\w+@[a-zA-Z_]+?.[a-zA-Z]{2,3}$');
if (!nameExp.hasMatch(value)) return 'Invalid email address';
return null;
}
String validatePassword(String value) {
if (value.isEmpty) return 'Please choose a password.';
return null;
}
@OverRide
Widget build(BuildContext context) {
size=MediaQuery.of(context).size;
return new Scaffold(
key: _scaffoldKey,
appBar: new AppBar(
title: new Text("Edit Profile"),
),
body:new SingleChildScrollView(
}
Future getImageCamera() async{
var imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);
setState(() {
_image = imageFile;
});
uploadimage(_image, constant.u_id);
}
Future postData(Map data1) async {
}
Future uploadimage(File imageFile,String id)
async {
var stream = new http.ByteStream(DelegatingStream.typed(imageFile.openRead()));
// get file length
var length = await imageFile.length();
}
void loaddata() async {
String url1 = "http://manishvvasaniya.000webhostapp.com/rovehicle/user.php?id="+constant.u_id;
debugPrint(url1);
var response = await http.get(url1);
debugPrint(url1);
if (response.statusCode == 200) {
String data1 = response.body;
var data2=json.decode(data1);
}
}
The text was updated successfully, but these errors were encountered: