utiler 1.0.2
utiler: ^1.0.2 copied to clipboard
Essential utility functions and helpers for Dart/Flutter projects. Simplify everyday coding with tools for common logic patterns. Developed by Mehrab Ghassab
π Utiler #
A comprehensive Dart/Flutter utility toolkit that simplifies everyday development tasks β from async handling and concurrency to logging, storage, networking, UI helpers, and global app configuration.
β¨ Features #
β± Async Utilities #
- Debouncer β Prevent rapid repeated calls (e.g., search input)
- Throttler β Limit execution rate over time
- Retry β Retry failed async operations with configurable logic
β‘ Concurrency Utilities #
- BatchExecutor β Execute tasks in controlled batches
- ParallelExecutor β Run multiple async tasks in parallel
π§ Core Utilities #
- InternetConnectivity β Real-time network status detection (connected, disconnected, VPN)
- Either β Functional error handling (Left/Right pattern)
- Guard β Safe execution wrapper
- LazyValue β Lazy initialization helper
- LifecycleHandler β App lifecycle observer
πΎ Database Layer #
- Database β Unified adapter for JSON & secure storage with CRUD
- JsonDatabase β Local storage using Hive
- SecureDatabase β Secure key-value storage
π Extensions #
- Context, Iterable, List, Map, Num, and String extensions
π Logging System #
- Logger β Base logging functionality
- PrettyLogger β Formatted readable logs
- LoggerConsole (UI) β In-app log viewer
- StopwatchLogger β Measure execution time
π API Service #
- ApiService β CRUD methods (GET, POST, PUT, DELETE) built on http
π¨ UI Utilities #
- Collection of reusable widgets and helpers
π UtilerScope (Core System) #
UtilerScope is the main entry point of the package.
It wraps your entire Flutter application and provides a unified system for:
- π Theme management (light/dark or dynamic themes)
- π Locale management (internationalization)
- π‘ Lifecycle tracking
- π Logging system (console + optional export)
- βοΈ Global configuration access via context
Instead of manually managing theme, locale, and app-wide state, UtilerScope centralizes everything into a single scope.
π§© Example Usage #
import 'package:flutter/material.dart';
import 'package:utiler/utiler.dart';
void main() {
runApp(
UtilerScope(
lifecycleListener: (state) {
debugPrint('App lifecycle changed: $state');
},
enabledLog: true,
exportLog: true,
showLogWidget: true,
jsonThemesAddress: const [
'assets/theme/light.json',
'assets/theme/dark.json',
],
jsonLocalesAddress: const [
'assets/locale/en.json',
'assets/locale/fa.json',
],
child: const MyApp(),
),
);
}
Once wrapped, you can access everything anywhere in your app:
context.appJsonTheme
context.appJsonLocale
context.changeAppTheme('dark')
context.changeAppLocale('en')
Or using the static methods on UtilerScope without a BuildContext:
UtilerScope.changeAppTheme('dark')
UtilerScope.changeAppLocale('en')
This design removes the need for separate state management solutions for theme, locale, or global app configuration, keeping everything centralized and easy to maintain inside a single unified scope.
π¦ Examples #
All features in Utiler include dedicated usage examples inside the example/ folder.
Each utility has practical, ready-to-run snippets so you can quickly understand and integrate it into your project.
π Simply check the example/ directory in the package source to explore them.
π Feature Generator (create_feature) #
CLI tool to generate Clean Architecture features.
dart run utiler:create_feature -n feature_name -b -r
Arguments:
-n, --nameβ Feature name (required)-b, --use-blocβ Add Bloc state management-r, --use-riverpodβ Add Riverpod dependency injection
Generates a ready-to-use feature structure inside lib/features/.
π‘ Why Utiler? #
- All-in-one utility toolkit
- Reduces boilerplate code
- Improves code readability
- Clean architecture friendly
- Production-ready design for Flutter apps
π« Contact Me #
If you need anything or have an offer, you can reach me at:
- LinkedIn: https://www.linkedin.com/in/mehrab-ghasab
- Telegram: https://t.me/mehrabgh1