Building a Movie Searcher with RxDart and SQLite in Dart's Flutter Framework (Part 1)

What Will I Learn?

  • You will learn how to dynamically get an API request and use a Debounce Observable
  • You will learn how to model data and use that data in a stream
  • You will learn how to use RxDart in a flutter project
  • You will learn how to use the Icon Button widget and the Publish Subject stream controller

Requirements

Difficulty

  • Intermediate

Description

In this video tutorial, we start building out a Movie Searcher application in Dart's Flutter Framework. This application makes use of the RxDart plugin, the Path Provider plugin and the SQLite Sqflite plugin. The overall design behind this application is to have a search bar which allows the user to query for movies. When the user enters an input into search bar, the application calls to the API which fetches a list of movies. The user will then have the ability to favorite or star a movie which will push it into the SQLite database and the user will also be able to click on the card which will expand it out to show more information about the movie to the user.

In this first part, we built out the model of our application. We also built out the internal logic for making the API request and fetching the list of movies. This part of the tutorial, featured some concepts from RxDart such as the Publish Subject stream controller and Debounce Observables. We use a Debounce Observable because it allows us to set a bit of time-lag between when the user types in a letter and when the API returns the list of times. The application will return more items in the list at once then if we were to handle the response in real time.

We also take a look at the main difference between using a Publish Subject instead of a simple stream controller. The Publish Subject allows us to return an observable which gives us various advantages that a stream controller does not have by default. For instance, Streams are pull-based and Observables are push-based. This simple idea has far reaching consequences in the concrete areas of our application. Observables also allow for multiple subscribers where as streams only allow for a single subscriber.

The source code for this project can be found here

Video Tutorial

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

H2
H3
H4
3 columns
2 columns
1 column
4 Comments