Posts

Flutter Categories

Mastering Flutter's Text Field: A Common Class for Flutter Material Text Field

Image
Flutter text field is an essential widget that allows users to enter text in a mobile app. In this blog post, you'll learn everything you need to know about Flutter text fields, from creating a basic text field to implementing advanced features such as input validation and formatting. Usage:  CommonTextField  widget is a custom text input field in Flutter that provides additional features and customizations beyond the standard TextField widget.  It has properties for setting text input type, hint text, error text, prefix icon, text color, background color, and border radius, among others. It also has validation capabilities that can be used to check user input and provide confirmation or error messages. Code: .. Properties: Property Description controller (required) The TextEditingController that controls the text field's content. hintText The hint text that appears when the text field is empty. keyboardTyp

Simplifying Data Persistence in Flutter with Shared Preferences

Image
Managing Local Storage Data in Flutter Apps with  Shared Preferences  and a Common Utility Class. It provides a  simple key-value storage solution  that can be used to store and retrieve primitive data types, such as booleans, integers, doubles, strings, and lists of strings.  This makes it a useful tool for managing user preferences, caching data, and persisting app state. dependencies: flutter: sdk: flutter shared_preferences: ^2.2.2 Usage:  Shared Preferences  can be used to store and retrieve key-value data in your Flutter app. It is particularly useful for storing small amounts of data that need to persist between app sessions.  Some examples of data that could be stored using Shared Preferences include user preferences, app settings, and cached data. .. Call the function you need :  To use the functions in this SharedPrefUtils class, you can follow these steps: For example,  #1 To save a  boolean  value to SharedPreferences, you can call the  saveBool  function: bool val

Flutter Debugging Custom Log: Colorful Logs for Effortless Debugging

Image
Dive into a world of vibrant Flutter debugging with our Colorful Logging utility!  No Third-Party Plugins Needed! This blog introduces a simple yet potent tool that adds a burst of color to your console messages, making log levels pop.  Bonus: Say goodbye to cluttered production logs, as this utility seamlessly excludes itself in production builds. Usage: Logging in Flutter is a crucial part of debugging, but the traditional black and white logs can be uninspiring. Our logging utility, complete with colorful indicators, brings clarity to your console.  Benefits: Visual Clarity: Colored messages stand out, aiding in the quick identification of log levels. Debugging Efficiency: Swiftly locate and focus on the most critical messages. Customization: Tailor colors or add more log levels to align with your preferences. Production Exclusion: Log messages exclusively surface in debug mode, leaving production logs pristine.