Welcome to EasyCoding with Ammara
Subscribe My Coding Channel:
https://www.youtube.com/channel/UC8UsfNYmbKiRJvI9ZhhApEw?view_as=subscriber
Subscribe my personal YouTube Channel:
https://www.youtube.com/channel/UCa93R2oNQMuX0fOKa9eV4zg?view_as=subscriber
See Video for Connection:
Create registration.dart file and paste code:
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
class Register extends StatefulWidget {
@override
_RegisterState createState() => _RegisterState();
}
class _RegisterState extends State
final fb = FirebaseDatabase.instance;
var retrievedName="";
String name = "";
@override
Widget build(BuildContext context) {
final ref=fb.reference().child("Student");
return Scaffold(
appBar: AppBar(
title: Text("Registration"),
),
body: Container(
child: Column(
children:
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Name',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
shadows: [Shadow(
blurRadius: 10,
color: Colors.blue,
)]
),
),
),
Flexible(child: TextField(
onChanged: (val){
setState(() {
name=val;
});
},
)),
RaisedButton(
onPressed: (){
ref.child("name").set(name);
},
child: Text("Registration"),
),
RaisedButton(
onPressed: (){},
child: Text("Retrieve data"),
),
Text("EasyCoding"),
],
),
),
);
}
}