How to use API's in your Flutter BLOC Project - UPDATED 2022 (flutter_bloc v8)
by everyDev youtube.com
25 min 34.2k views
Hey there! I've had a request to create a video on how to use API's in your Flutter project when you're using flutter_bloc. In this video, we use the "Bored API" as our endpoint to retrieve a JSON response, and then we use QuickType.io to generate our JSON serialisation/deserialisation logic. We then map the response to our UI, and give the user the option to refresh the page if they want to . Finally, we bring in connectivity_plus to detect if the user is offline, and prevent them from using the app if this is the case. I make a typo later in the guide where I accidentally declare a variable 'late' where I meant to declare it final, but I've highlighted that accordingly, and should work as shown in the video 😀 Sample project: https://github.com/flutterfromscratch/bloc-v8-apis Enjoy the video? Say thanks by buying me a coffee: https://www.buymeacoffee.com/flutterscratch 00:00 - Intro 01:03 - Creating the sample project 01:18 - Setting up dependencies 01:43 - Looking at "Bored API" 03:20 - Generating our API Client with QuickType 04:45 - BLOC - States 05:51 - BLOC - Events 07:15 - Including the http package 07:32 - Creating the BoredService 09:28 - BLOC - Business Logic 11:00 - Bootstrapping the BLOC package and dependency injection 11:40 - Creating the UI 13:10 - BLOC - BlocBuilder 16:05 - Running the sample app 16:33 - Adding a refresh button 18:05 - Bringing in connectivity_plus 20:48 - Connecting connectivity_plus into our UI 23:56 - Sample app with connectivity_plus 24:30 - Conclusion
Topics Bloc
More like this
Article 19 min readHow to Leverage BLoC for Code Sharing in Flutter and AngularDart
by Marko Perutović
Learn how the BLoC pattern can lead to more than 50% code reuse in both your Flutter mobile apps and your AngularDart web app! BLoC is a paradigm through which you can isolate your business logic in p...
Read on toptal.com
Video 12 minWhat is the BLoC pattern in Flutter?
by GiancarloCode
🔥 In this part of the Flutter course you will learn what is the BLoC Pattern and how to state management in Flutter with the BLoC pattern 🔥 📚 Content: 💡 00:09 What is the BLoC Pattern? 💡 00:33 Wh...
Watch on YouTube
Article 15 min readGetting Started With Flutter BLoC
Learn to use BLoC properly with this article by Kacper Kogut
Read on dev.to
Video 35 minExpense Tracker App • Flutter & BLoC Tutorial for Beginners
by HeyFlutter․com
Watch on YouTube