Member-only story
Create a Login Screen with Provider Pattern
When Flutter was launched, the architecture pattern initially followed was called the ‘Bloc’ pattern. This is still widely used in the Flutter community today. In this article, we will look at creating a login screen. However, instead of using the Bloc pattern, we will use the Provider pattern to achieve this, which is also popular in the Flutter community.
Why use the Provider pattern?
The answer lies in its simplicity. It is both easier to understand and implement. We do not need streams and observables in the Provider pattern as is the case with RxDart in the Bloc pattern.
Prerequisites
- To implement the Bloc pattern, we must install the latest bloc package from pub dev, which is version 6.1.1
- To implement the Provider pattern, the latest version of the provider package from pub dev must be installed, i.e., version 4.3.3
Before beginning, here are all the key topics that will be addressed as we proceed with building our login screen:
- Defining widget states
- The consumer widget
