Flutter + Django + Rest Framework

So a few days ago I made Yet Another Flutter Login (YAFL) which is a nice little starter for working with Firebase login. Sometimes though I like to fall back to good ol’ Django and Python so I did a little refactoring of YAFL, threw together a django server and made Flutter DRF. The only real changes from YAFL is how it connects using the excellent http and retry packages.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
final resp = await retry(
() async {
final response = await client
.post('$baseUrl$loginUrl', body: loginToJson(login), headers: {}..addAll(jsonHeader()))
.timeout(Duration(seconds: 5));
return response;
},
retryIf: (e) => e is SocketException || e is TimeoutException,
);
if (resp.statusCode == 200) {
var jsonResponse = json.decode(resp.body);
_token = jsonResponse['key'];
await storage.write(key: 'token', value: _token);
_isSignedIn = true;
prefs.setString('email', email);
} else {
caughtExc(resp.body.toString());
signout();
}

On the server side there is quite a lot of boilerplate to write so I opted to get up and running quickly with cookiecutter-django and django-rest-auth the result of which you can find at flutter_drf_django.

Hope it’s useful to someone else and if you have any feedback, please let me know :)

YAFL - Yet Another Flutter Login starterkit

Have you played around with Flutter yet? If not, you should. I have never been too keen on frameworks claiming to make it easy to write both Android and iOS apps from a single codebase, but Flutter seems to get it right. The biggest benefit for me is how easy it was to setup and the integration with Android Studio/Emulator/iOS Emulator. Granted, it is still fairly new just like the Dart language it is built upon (OK, Dart is 7 years old but still it is kind of new!) but if it keeps on its current trajectory it is likely to be the default goto for building apps.

Anyway, I digress. I always find the best way to start learning a new framework/language is to jump straight in. Pick something that you know you are going to need and build it. Many apps require a login of some sort so I figured I would have a crack at a simple login/registration form integrated with Firebase. I started by downloading all the ones I could find (https://startflutter.com is helpful for that and of course https://github.com) and then took it from there.

https://gitlab.com/buzzcat/yafl

https://github.com/buzzcat-com/YAFL

Check it out, see what you think. Hopefully it’s helpful to someone besides me. Be aware that I haven’t spent a hell of a lot of time caressing it and getting all the small Dart and flutter nuances under control so don’t be surprised if you find some small bugs (but please report them through gitlab)!

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×