Open himangshu190 opened 3 years ago
please help me
import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:http/http.dart' as http; import 'DashBoard.dart'; import 'main.dart';
class Register extends StatefulWidget { @override _RegisterState createState() => _RegisterState(); }
class _RegisterState extends State
Future register() async { var url = "http://192.168.88.137/db_login_reg/register.php"; var response = await http.post(url, body: { "email": email.text, "password": pass.text, "fullname": fullname.text, }); var data = json.decode(response.body); if (data == "Error") { FlutterToast(context).showToast( child: Text( 'User allready exit!', style: TextStyle(fontSize: 25, color: Colors.red), )); } else { FlutterToast(context).showToast( child: Text('Registration Successful', style: TextStyle(fontSize: 25, color: Colors.green))); Navigator.push( context, MaterialPageRoute( builder: (context) => DashBoard(), ), ); } }
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'Welcome to ACCF',
style: TextStyle(fontWeight: FontWeight.bold),
),
),
body: Container(
height: 700,
child: Card(
color: Colors.white,
child: Column(
children:
E/flutter (15879): #1 _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1271:9) E/flutter (15879): #2 _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:936:22) E/flutter (15879): #3 _parseJson (dart:convert-patch/convert_patch.dart:40:10) E/flutter (15879): #4 JsonDecoder.convert (dart:convert/json.dart:506:36) E/flutter (15879): #5 JsonCodec.decode (dart:convert/json.dart:157:41) E/flutter (15879): #6 _RegisterState.register (package:php_mysql_login_register/register.dart:26:21) E/flutter (15879):
E/flutter (15879):