In Flutter you could get or set a String value to the System Clipboard and you could do it on both Desktop and Mobile even on Web. The last platform is the most tricky for now, but the process there may/could be adapted on the other places by Google and Apple. Access to System Clipboard…
Category: Software Development
Do not use BuildContext across async gaps in Flutter
Using BuildContext across async work in Flutter can lead to issues, but there are several solutions to escape it. Why it’s a problem: Widget tree changes: When you use BuildContext to access the widget tree, it’s tied to a specific point in time. If the widget tree changes (e.g., due to an async operation), your…
How not to be replaced by AI
To not be replaced by AI – put in your basket of skills, experience and practice INTEGRATING with outside systems, because it is not super simple task that will be challenging for AI to fully replicate😅. What are Integrations There are tons of things that could be viewed as integrations 🤔 bringing the designer’s drawings…
To Rebuild or not to rebuild the UI in Flutter
ChangeNotifier in Flutter notifies all listeners, even if the data hasn’t actually changed and UI is getting rebuild. This means every widget that calls Provider.of(context) or uses Consumer will rebuild when notifyListeners() is called, regardless of whether the value they depend on has changed. The situation is similar with BLoCBuilder or BLoCListener – when there…
TextEditingController State in Flutter
n Flutter, TextEditingController is typically used with StatefulWidget because it needs to persist its state across widget rebuilds and be disposed after it is not needed. Example The best practice for managing a TextEditingController is to use a StatefulWidget so that the controller is properly disposed of when no longer needed. import ‘package:flutter/material.dart’; class MyStatefulWidget…
Flutter PopScope Usage
PopScope in Flutter is a widget that allows you to control the behavior of the system back button (Android) or the back swipe gesture (iOS). It’s useful when you want to override or prevent navigation pops under certain conditions. Usages of PopScope Prevent Accidental Exits: Show a confirmation dialog before exiting an app. Example: Asking…
Flutter Dev Cheatsheet
Here’s a Flutter Dev Development CheatSheet to help you with key concepts, commands, and code snippets: 1. Flutter CLI Commands Create a new project: flutter create my_app Run the app: flutter run -d chrome Build the app: Android APK: flutter build apk | appbundle iOS: flutter build ios Check devices: flutter devices Clean the project:…
What are the options for Dependency Injection in Flutter
There are several options for Dependency Injection in Flutter and your choice depends on the pick of State Management Solution, likability to code generators, etc ioc_container The ioc_container package offers a lightweight and high-performance DI solution. It emphasizes flexibility and simplicity, allowing for easy replacement of services, lifecycle management, and lazy initialization. Its minimalistic design…
Wrap Everythyng in Flutter
You could Wrap Every element in Flutter so it could be replaced, parameterized, customized, made more testable and more. The aspects are: internationalization – you want to support your users locale, colors – you want to support light and dark theme, themes, icons – so they could switch between themes (and locales) packages – could…
Flutter Custom Header to every Request with the http package
Yes, you can add a Custom Header to every request with the http package in Flutter. Here’s an example of how you can achieve this: import ‘package:http/http.dart’ as http; class AuthHttpClient { final http.Client client; AuthHttpClient({ required this.client, }); //plain request path through. All details are in the hands of the user of this method…