In Flutter development, mocking Dependencies is a crucial technique for isolating unit tests and ensuring that your codebase remains stable and efficient with the cross language library Mockito. Any developer with long enough experience has faced challenges of testing and maintaining complex software systems. In this article, we’ll explore the usage of Mockito in Flutter,…
Category: Flutter
How to format date and time to string in dart
You can use the intl package in Dart to format date and time variables and present them to your users in predefined pattern or in their local pattern. Here’s an example: First, add the intl package to your project by running the following command in your terminal: dart pub add intl Take into account the…
Flutter InkWell vs Button vs Material vs GestureDetector
There are several widgets to code Button behaviour in Flutter, besides the variations of Button, there are InkWell, Material & GestureDetector. 1. Material widgets Material: A widget that provides a material design background, but without actual behaviour MaterialButton: A button with a material design background with present ripple effect. // Material (Material) Material( elevation: 10,…
Internationalizing Flutter app with plain InheritedWidget
In this article I will be Implementing Internationalizing Flutter app from anywhere (within the app) with the help of arb files, plain InheritedWidget. I’ll be taking advantage and building on a previous article Flutter Localization with intl https://programtom.com/dev/2024/10/14/flutter-localization-with-intl/. MaterialApp fields Locale in a Flutter App is set through a locale field present in the Master…
shared_preferences is failing with Flutter 3.27
The update of Flutter to 3.27 is why it is good idea to have wrappers even for the components provided and developed by the Platform providers – in my case failing shared_preferences – especially when the provider is Google. Failing with issues There are several variations of issues: No implementation found for method getAll on…
Flutter HTML
Here are some examples of rendering HTML in Flutter using different packages – depending on the platforms you are going to target your apps. 1. HtmlElementView Class The HtmlElementView widget is build-in component, but it is meant to be used on the Web Platform. It may suite your needs if you only going to target…
Flutter 3.27 web – TextFormField – The targeted input element must be the active input element
Upgrading any software aften introduces bugs – alongside the fixes and Flutter 3.27 is no different – introducing issues in TextFormField on the web Platform. The TextFormField web issues https://github.com/flutter/flutter/issues/156842 https://github.com/flutter/flutter/issues/160155 There are probably more. Temp Solution In my experience forcing the Flutter Engine to use WASM as the Web Target silenced the problem. Long…
Flutter Remote CRUD Data Source – using the http package
Here’s an example of how you can implement CRUD operations using the http package in Flutter wrapped up in a Remote Data Source. This example assumes that your backend uses a REST API. First, add the http package to your pubspec.yaml file: dependencies: flutter: sdk: flutter http: ^0.2.2 Then, run flutter pub get to install…
Flutter Web App – how to send the user to some URL Address
You can use the url_launcher package in Flutter Web App to send the user to a URL Address. Here’s how you can do it: Step 1: Add the url_launcher package to your project You can add it by running the following command in your terminal: flutter pub add url_launcher Step 2: Import the url_launcher package…
Error – Failed to transform core-for-system-modules.jar to match attributes artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime
If you are developing an Android Application on some old (old) mac, and, after updating the Android Studio, the Flutter SDK, Java, etc you get: Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage …. Here are some changes that I’ve done to make it work. Android Development Requirements As pointed out here: https://stackoverflow.com/questions/69619829/could-not-resolve-all-files-for-configuration-appandroidjdkimage,…