Flutter + BloC + Back4App = Basic Chat App

https://www.youtube.com/watch?v=qUvI0D1rmwc

Requirements:

  • This tutorial requires you need to know BloC knowledge. If not, please read this document first. [EDITED: new bloc version has been supported in this tutorial]

Direction:

  1. Setup a new app on Back4App with Live Query enabled.
  2. Create UI for 3 pages: login, signup, and home page.
  3. Create Repository.
  4. Create Business Logic (BloC) for each page.

Setup a new app on Back4App:

  • Back4App is a flexible and scalable platform based on the Parse platform.
  • Create New App: Back4App-Demo
  • Copy application configs to main.dart
App Settings on Back4App
Enable Live Query in Server Settings
main.dart

Create UI

  1. Login page:
login page
  • The full source code of the login page looks like this:
login.dart
signup page
  • The full source code of signup page:
signup.dart
home page
  • The full source code of home page:
home.dart

Create Repository:

  • User Repository: handle login/signup logic. This is the main class that interacts with the User class on Back4App.
user_repos.dart
  • Message Repository: the responsibility of this class is to manage the sending message process.
message_repos.dart

Business Logic (BloC)

  1. Auth BloC: Our AuthCubit is responsible for receiving events and converting them into AuthStates. It will have a dependency on UserRepository so that it can retrieve ParseUser when the app started.
  • AuthStates:
auth_states.dart
  • AuthCubit:
auth_bloc.dart
  • LoginStates:
login_states.dart
  • LoginCubit:
login_bloc.dart
  • SignupStates:
signup_states.dart
  • SignupCubit:
signup_bloc.dart
  • HomeStates:
home_states.dart
  • HomeCubit:
home_bloc.dart

--

--

--

I’m a peaceful person who wants to make friend with people around the world.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Chakra-UI Crash Course

C# Beginner

Bluetooth Mesh: Technology Overview, Examples, Alternatives, and First-Hand Experience

Check a matrix is sparse matrix or not in Python?

All my calendars in one place

Declaration of Homestead

Spell check your Erlang code with Sheldon

The Best and Worst Feedback You Can Get

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Trong Dinh Thai Hoang

Trong Dinh Thai Hoang

I’m a peaceful person who wants to make friend with people around the world.

More from Medium

Introduction to Flutter

Flutter Live Data Tutorial

How to Integrate Ortho in Your Flutter App

Input formatters in Textfield Flutter