Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
Flutter Bloc List Network

Flutter Bloc List Network

Posted on January 8, 2022January 18, 2022 by Toma Velev

Here is the evolution of my personal – first – on-hand experience – with Flutter Bloc List Network example that uses different techniques and approaches. I’ve used a product that I’m developing – that is available for sell – with different variations. My goal is to include an app version in the near future.

Before looking at the network versions, read the:

  • Minimal Bloc – from Scratch & the basic app overview – with potential future plans and evolutions.
  • Minimal List Example & the basic Bloc List overview snippets.

Flutter – Loading list – with Basic Network

The Example code is located here: https://github.com/tomavelev/dev_examples/tree/master/bloc/lib_bloc_basic_network. It is a minimal app that extends the previous – in memory examples – with data – loaded from server. The most basic way to access resources from the Internet is with the http dart package. In this case – you/me/the client developer/ – is responsible for all and manually – passing the URL, response parsing, data conversion, error handling.

Flutter – Loading list – with Dio

The next Evolution is to wrap the http with the dio package. The evolution the code could be seen here: https://github.com/tomavelev/dev_examples/tree/master/bloc/lib_bloc_network_dio.

Bonus feature of the dio package are the interceptors. With them – You could handle in a single place – authentication, caching, logging or some custom network logic.

Flutter Bloc List Network + Retrofit

The repeating part in the upper examples is the response handling and data transformation. You could delegate this functionality to packages like retrofit. It’s a library already battle tested in Android Native Development. I’ve seen it in practice – with apps that I’ve participated – deployed in production in previous companies I’ve worked for.

The package for flutter is located here: https://pub.dev/packages/retrofit. A thing to get into your head is – it is a generator library. Second thing that I’ve found is – it requires from the back-end to have set – the Content-Type Header. https://github.com/tomavelev/dev_examples/blob/master/bloc/lib_bloc_network_retrofit_json/network.dart. Otherwise – it does not convert the String in the response out of the box.

I’ve written about Code Generation – in philosophical terms – in a previous post: https://programtom.com/dev/2022/01/13/levels-of-code-generation/. I’ve developed several code, no-code tools with minimal success. Maybe it is time to dive in Code Generation from another point of view – developer experience while coding – and less – idealistic, business, marketing, end user requirements or philosophy.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Jenkins SCP File Upload to Remote Server
  • Essential Programming Books – Principles & Flutter
  • Social Media Platforms 🌍
  • Strategies to prevent review regressions
  • How to set Google Map Theme in a Flutter App

Categories

  • Apps (22)
  • ChatGPT (23)
  • Choosing a Framework (38)
  • Flutter (269)
  • Graphical User Interface (14)
  • Marketing (117)
  • Software Development (286)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (15)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (84)
    • Flutter Apps (24)
    • GPT (4)
    • Java (38)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (35)
    • Utils (15)
    • Vaadin 24+ (27)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Jenkins SCP File Upload to Remote Server
  • Essential Programming Books – Principles & Flutter
  • Social Media Platforms 🌍
  • Strategies to prevent review regressions
  • How to set Google Map Theme in a Flutter App

Post Categories

  • Apps (22)
  • ChatGPT (23)
  • Choosing a Framework (38)
  • Flutter (269)
  • Graphical User Interface (14)
  • Marketing (117)
  • Software Development (286)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (15)