Flutter with Python Django RESTFUL API












0














Need Help



I have written a flutter widgets for my application for the User Signup in my application and also an API with Django RESTFUL API. How do I connect or integrate the API routes/URL in python Django with the flutter widgets? Please, I need a sample code. I will appreciate any help.



Here is my signup flutter widget:



  import 'package:flutter/material.dart';

class SignUpPage2 extends StatefulWidget {
@override
SignUpPage2State createState() => SignUpPage2State();
}

class SignUpPage2State extends State<SignUpPage2> {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,

leading: IconButton(
icon: new Icon(Icons.arrow_back,
color:Colors.orange.shade700),
onPressed: () {

Navigator.pop(context);

},
),

title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),
backgroundColor: Colors.black,
),
backgroundColor: Colors.black45,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[

new Center(
child: new Text("Welcome",
style: new TextStyle(
color: Colors.orange.shade700,
fontFamily: 'Poppins-Bold',
fontSize: 30.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 10.0),

new Center(
child: new Text("Please, Introduce Yourself",
style: new TextStyle(
color: Colors.white,
fontFamily: 'Poppins',
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 20.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'First Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'Last Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.phone,
autofocus: false,
decoration: InputDecoration(
hintText: 'Phone',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.datetime,
autofocus: false,

decoration: InputDecoration(
hintText: 'Date of Birth',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
obscureText: true,
// initialValue: 'john@gmail.com',
decoration: InputDecoration(
hintText: 'Password',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

Padding(
padding: EdgeInsets.symmetric(
vertical: 16.0),
child: Material(
borderRadius: BorderRadius.circular(30.0),
// shadowColor: Colors.orange.shade700,
// elevation: 5.0,
child: MaterialButton(
minWidth: 200.0,
height: 60.0,
onPressed: (){
setState(() {

Navigator.of(context).pushNamed('/SignUpPage3');


} ,
color: Colors.orange.shade700,
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 23.0,
),
),
),
),
),

]
),
),
);
}}









share|improve this question
























  • You should provide a minimal example to reproduce a problem, this is way too long
    – BlueSheepToken
    Nov 21 '18 at 14:13
















0














Need Help



I have written a flutter widgets for my application for the User Signup in my application and also an API with Django RESTFUL API. How do I connect or integrate the API routes/URL in python Django with the flutter widgets? Please, I need a sample code. I will appreciate any help.



Here is my signup flutter widget:



  import 'package:flutter/material.dart';

class SignUpPage2 extends StatefulWidget {
@override
SignUpPage2State createState() => SignUpPage2State();
}

class SignUpPage2State extends State<SignUpPage2> {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,

leading: IconButton(
icon: new Icon(Icons.arrow_back,
color:Colors.orange.shade700),
onPressed: () {

Navigator.pop(context);

},
),

title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),
backgroundColor: Colors.black,
),
backgroundColor: Colors.black45,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[

new Center(
child: new Text("Welcome",
style: new TextStyle(
color: Colors.orange.shade700,
fontFamily: 'Poppins-Bold',
fontSize: 30.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 10.0),

new Center(
child: new Text("Please, Introduce Yourself",
style: new TextStyle(
color: Colors.white,
fontFamily: 'Poppins',
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 20.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'First Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'Last Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.phone,
autofocus: false,
decoration: InputDecoration(
hintText: 'Phone',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.datetime,
autofocus: false,

decoration: InputDecoration(
hintText: 'Date of Birth',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
obscureText: true,
// initialValue: 'john@gmail.com',
decoration: InputDecoration(
hintText: 'Password',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

Padding(
padding: EdgeInsets.symmetric(
vertical: 16.0),
child: Material(
borderRadius: BorderRadius.circular(30.0),
// shadowColor: Colors.orange.shade700,
// elevation: 5.0,
child: MaterialButton(
minWidth: 200.0,
height: 60.0,
onPressed: (){
setState(() {

Navigator.of(context).pushNamed('/SignUpPage3');


} ,
color: Colors.orange.shade700,
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 23.0,
),
),
),
),
),

]
),
),
);
}}









share|improve this question
























  • You should provide a minimal example to reproduce a problem, this is way too long
    – BlueSheepToken
    Nov 21 '18 at 14:13














0












0








0







Need Help



I have written a flutter widgets for my application for the User Signup in my application and also an API with Django RESTFUL API. How do I connect or integrate the API routes/URL in python Django with the flutter widgets? Please, I need a sample code. I will appreciate any help.



Here is my signup flutter widget:



  import 'package:flutter/material.dart';

class SignUpPage2 extends StatefulWidget {
@override
SignUpPage2State createState() => SignUpPage2State();
}

class SignUpPage2State extends State<SignUpPage2> {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,

leading: IconButton(
icon: new Icon(Icons.arrow_back,
color:Colors.orange.shade700),
onPressed: () {

Navigator.pop(context);

},
),

title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),
backgroundColor: Colors.black,
),
backgroundColor: Colors.black45,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[

new Center(
child: new Text("Welcome",
style: new TextStyle(
color: Colors.orange.shade700,
fontFamily: 'Poppins-Bold',
fontSize: 30.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 10.0),

new Center(
child: new Text("Please, Introduce Yourself",
style: new TextStyle(
color: Colors.white,
fontFamily: 'Poppins',
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 20.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'First Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'Last Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.phone,
autofocus: false,
decoration: InputDecoration(
hintText: 'Phone',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.datetime,
autofocus: false,

decoration: InputDecoration(
hintText: 'Date of Birth',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
obscureText: true,
// initialValue: 'john@gmail.com',
decoration: InputDecoration(
hintText: 'Password',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

Padding(
padding: EdgeInsets.symmetric(
vertical: 16.0),
child: Material(
borderRadius: BorderRadius.circular(30.0),
// shadowColor: Colors.orange.shade700,
// elevation: 5.0,
child: MaterialButton(
minWidth: 200.0,
height: 60.0,
onPressed: (){
setState(() {

Navigator.of(context).pushNamed('/SignUpPage3');


} ,
color: Colors.orange.shade700,
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 23.0,
),
),
),
),
),

]
),
),
);
}}









share|improve this question















Need Help



I have written a flutter widgets for my application for the User Signup in my application and also an API with Django RESTFUL API. How do I connect or integrate the API routes/URL in python Django with the flutter widgets? Please, I need a sample code. I will appreciate any help.



Here is my signup flutter widget:



  import 'package:flutter/material.dart';

class SignUpPage2 extends StatefulWidget {
@override
SignUpPage2State createState() => SignUpPage2State();
}

class SignUpPage2State extends State<SignUpPage2> {

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,

leading: IconButton(
icon: new Icon(Icons.arrow_back,
color:Colors.orange.shade700),
onPressed: () {

Navigator.pop(context);

},
),

title: Text("Create acount", style: TextStyle(color:Colors.orange.shade700)),
backgroundColor: Colors.black,
),
backgroundColor: Colors.black45,
body: Center(
child: ListView(
shrinkWrap: true,
padding: EdgeInsets.only(left: 24.0, right: 24.0),
children: <Widget>[

new Center(
child: new Text("Welcome",
style: new TextStyle(
color: Colors.orange.shade700,
fontFamily: 'Poppins-Bold',
fontSize: 30.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 10.0),

new Center(
child: new Text("Please, Introduce Yourself",
style: new TextStyle(
color: Colors.white,
fontFamily: 'Poppins',
fontSize: 20.0,
),
textAlign: TextAlign.center,
),
),
SizedBox(height: 20.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'First Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.text,
autofocus: false,
decoration: InputDecoration(
hintText: 'Last Name',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.phone,
autofocus: false,
decoration: InputDecoration(
hintText: 'Phone',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),


TextField(
keyboardType: TextInputType.datetime,
autofocus: false,

decoration: InputDecoration(
hintText: 'Date of Birth',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

TextField(
keyboardType: TextInputType.text,
autofocus: false,
obscureText: true,
// initialValue: 'john@gmail.com',
decoration: InputDecoration(
hintText: 'Password',
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(32.0),
),
),
),
SizedBox(height: 15.0),

Padding(
padding: EdgeInsets.symmetric(
vertical: 16.0),
child: Material(
borderRadius: BorderRadius.circular(30.0),
// shadowColor: Colors.orange.shade700,
// elevation: 5.0,
child: MaterialButton(
minWidth: 200.0,
height: 60.0,
onPressed: (){
setState(() {

Navigator.of(context).pushNamed('/SignUpPage3');


} ,
color: Colors.orange.shade700,
child: Text(
"Next",
style: TextStyle(
color: Colors.white,
fontSize: 23.0,
),
),
),
),
),

]
),
),
);
}}






python django dart flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 14:31









stt106

1,2191023




1,2191023










asked Nov 21 '18 at 13:52









Azeez Akinsola

1




1












  • You should provide a minimal example to reproduce a problem, this is way too long
    – BlueSheepToken
    Nov 21 '18 at 14:13


















  • You should provide a minimal example to reproduce a problem, this is way too long
    – BlueSheepToken
    Nov 21 '18 at 14:13
















You should provide a minimal example to reproduce a problem, this is way too long
– BlueSheepToken
Nov 21 '18 at 14:13




You should provide a minimal example to reproduce a problem, this is way too long
– BlueSheepToken
Nov 21 '18 at 14:13












1 Answer
1






active

oldest

votes


















0














You need to add http package to your project. Then wrap the http call to your Python REST endpoint in a Future.
I hate posting a link as an answer but in this case can't think of anything better than this cookboook example which answers your question perfectly!






share|improve this answer





















  • I will try this out.
    – Azeez Akinsola
    Nov 22 '18 at 7:18











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413609%2fflutter-with-python-django-restful-api%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You need to add http package to your project. Then wrap the http call to your Python REST endpoint in a Future.
I hate posting a link as an answer but in this case can't think of anything better than this cookboook example which answers your question perfectly!






share|improve this answer





















  • I will try this out.
    – Azeez Akinsola
    Nov 22 '18 at 7:18
















0














You need to add http package to your project. Then wrap the http call to your Python REST endpoint in a Future.
I hate posting a link as an answer but in this case can't think of anything better than this cookboook example which answers your question perfectly!






share|improve this answer





















  • I will try this out.
    – Azeez Akinsola
    Nov 22 '18 at 7:18














0












0








0






You need to add http package to your project. Then wrap the http call to your Python REST endpoint in a Future.
I hate posting a link as an answer but in this case can't think of anything better than this cookboook example which answers your question perfectly!






share|improve this answer












You need to add http package to your project. Then wrap the http call to your Python REST endpoint in a Future.
I hate posting a link as an answer but in this case can't think of anything better than this cookboook example which answers your question perfectly!







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 14:39









stt106

1,2191023




1,2191023












  • I will try this out.
    – Azeez Akinsola
    Nov 22 '18 at 7:18


















  • I will try this out.
    – Azeez Akinsola
    Nov 22 '18 at 7:18
















I will try this out.
– Azeez Akinsola
Nov 22 '18 at 7:18




I will try this out.
– Azeez Akinsola
Nov 22 '18 at 7:18


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413609%2fflutter-with-python-django-restful-api%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'