๐ฅ Quicklit
Quicklit is a blazing-fast Flutter toolkit built for hackathon-ready apps.
It bundles essential UI components, utility helpers, and a CLI-powered model generator โ all in one package.
โจ Features
-
โ Prebuilt Login & Register UI (Firebase-ready)
-
โ Dark/Light mode toggle widget
-
โ Internet connectivity checker
-
โ Snackbar, dialog, and toast utilities
-
โ Local storage helper using
SharedPreferences -
โ Stopwatch & timer utilities
-
โ
isDebug()andisRelease()environment helpers -
โ CLI-powered JSON โ Dart model generator (with
.g.dartsupport)Usage: dart run quicklit:model_gen <json_file> --class
Options: --help, -h Show this help message --version Show version information --install-deps Force install/reinstall base dependencies --get-login Generate complete auth boilerplate with BLoC --firebase Use Firebase Authentication (with --get-login) --api Use API/REST Authentication (with --get-login)
defaultExamples:
JSON Model Generation
dart run quicklit:model_gen user.json --class UserModel dart run quicklit:model_gen data.json --class DataModel
Auth Boilerplate Generation
dart run quicklit:model_gen --get-login --firebase dart run quicklit:model_gen --get-login --api dart run quicklit:model_gen --get-login # Prompts for choice
๐ฆ Installation
Add this to your pubspec.yaml:
dependencies:
quicklit: ^1.1.0
Then run:
flutter pub get
๐ Usage
โ 1. Use Prebuilt Auth Screens
import 'package:quicklit/quicklit.dart';
void main() {
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: QuicklitLoginPage(), // or QuicklitRegisterPage()
));
}
โ 2. Toggle Theme
QuicklitThemeToggle() // Widget
โ 3. Use Local Storage
await QuicklitStorage.saveString('username', 'shreyash');
String? name = await QuicklitStorage.getString('username');
โ 4. Check Internet Connection
QuicklitConnectionChecker(
onOnline: () => print('Connected'),
onOffline: () => print('Disconnected'),
)
โ 5. Utility Functions
// Environment helpers
if (QuicklitUtils.isDebug()) {
print('Running in debug mode');
}
if (QuicklitUtils.isRelease()) {
print('Running in release mode');
}
// Snackbar utilities
QuicklitSnackbar.show(context, 'Success message');
QuicklitSnackbar.error(context, 'Error message');
// Dialog utilities
QuicklitDialog.show(
context,
title: 'Confirmation',
content: 'Are you sure?',
onConfirm: () => print('Confirmed'),
);
// Toast utilities
QuicklitToast.show('Quick toast message');
โ๏ธ Model Generator (CLI)
Quicklit includes a powerful CLI tool to generate Dart model classes from any JSON response.
๐ ๏ธ Command
dart run quicklit:model_gen path/to/input.json --class YourModelName
๐ What It Does
โ
Outputs model in lib/models/your_model_name.dart
โ
Adds @JsonSerializable() annotations
โ Generates factory constructors
โ
Compatible with json_serializable
๐ Example
input.json
{
"id": 1,
"name": "Shreyash",
"isVerified": true
}
Run:
dart run quicklit:model_gen input.json --class UserModel
Generated Output: lib/models/user_model.dart
import 'package:json_annotation/json_annotation.dart';
part 'user_model.g.dart';
@JsonSerializable()
class UserModel {
final int id;
final String name;
final bool isVerified;
UserModel({
required this.id,
required this.name,
required this.isVerified,
});
factory UserModel.fromJson(Map<String, dynamic> json) =>
_$UserModelFromJson(json);
Map<String, dynamic> toJson() => _$UserModelToJson(this);
}
๐ง Advanced CLI Options
# Generate model with custom output directory
dart run quicklit:model_gen input.json --class UserModel --output custom/path/
# Generate model with nullable fields support
dart run quicklit:model_gen input.json --class UserModel --nullable
# Generate model with custom file name
dart run quicklit:model_gen input.json --class UserModel --filename custom_user
๐จ Complete Example
import 'package:flutter/material.dart';
import 'package:quicklit/quicklit.dart';
void main() {
runApp(const QuicklitApp());
}
class QuicklitApp extends StatelessWidget {
const QuicklitApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Quicklit Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData.light(),
darkTheme: ThemeData.dark(),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Quicklit Demo'),
actions: [
QuicklitThemeToggle(),
],
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
QuicklitConnectionChecker(
onOnline: () => QuicklitToast.show('Connected to internet'),
onOffline: () => QuicklitToast.show('No internet connection'),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () => _saveUserData(),
child: const Text('Save User Data'),
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () => _loadUserData(context),
child: const Text('Load User Data'),
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () => _showConfirmDialog(context),
child: const Text('Show Dialog'),
),
],
),
),
);
}
Future<void> _saveUserData() async {
await QuicklitStorage.saveString('username', 'shreyash');
await QuicklitStorage.saveBool('isVerified', true);
QuicklitToast.show('User data saved!');
}
Future<void> _loadUserData(BuildContext context) async {
final username = await QuicklitStorage.getString('username');
final isVerified = await QuicklitStorage.getBool('isVerified');
if (username != null) {
QuicklitSnackbar.show(
context,
'Welcome back, $username! ${isVerified == true ? 'โ
' : 'โ'}',
);
} else {
QuicklitSnackbar.error(context, 'No user data found');
}
}
void _showConfirmDialog(BuildContext context) {
QuicklitDialog.show(
context,
title: 'Confirmation',
content: 'Do you want to clear all data?',
onConfirm: () async {
await QuicklitStorage.clear();
QuicklitToast.show('All data cleared!');
},
);
}
}
๐ ๏ธ Available Utilities
Storage Helper
// Save data
await QuicklitStorage.saveString('key', 'value');
await QuicklitStorage.saveInt('key', 42);
await QuicklitStorage.saveBool('key', true);
await QuicklitStorage.saveDouble('key', 3.14);
// Load data
String? value = await QuicklitStorage.getString('key');
int? number = await QuicklitStorage.getInt('key');
bool? flag = await QuicklitStorage.getBool('key');
double? decimal = await QuicklitStorage.getDouble('key');
// Remove data
await QuicklitStorage.remove('key');
await QuicklitStorage.clear(); // Clear all data
Timer & Stopwatch
// Stopwatch
final stopwatch = QuicklitStopwatch();
stopwatch.start();
Duration elapsed = stopwatch.elapsed;
stopwatch.stop();
stopwatch.reset();
// Timer utilities
QuicklitTimer.delay(Duration(seconds: 2), () {
print('Executed after 2 seconds');
});
Environment Helpers
if (QuicklitUtils.isDebug()) {
print('Debug mode - show detailed logs');
}
if (QuicklitUtils.isRelease()) {
print('Release mode - hide debug info');
}
๐ Dependencies
Quicklit internally uses these Flutter packages:
shared_preferences- For local storageconnectivity_plus- For internet connection checkingjson_annotation- For JSON serialization
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
If you find any issues or have suggestions, please file an issue on the GitHub repository.
๐ฅ Quicklit
Quicklit is a blazing-fast Flutter toolkit built for hackathon-ready apps.
It bundles essential UI components, utility helpers, a CLI-powered model generator, and a complete auth boilerplate generator โ all in one package.
โจ Features
- โ Prebuilt Login & Register UI (Firebase & API-ready)
- โ Dark/Light mode toggle widget
- โ Internet connectivity checker
- โ Snackbar, dialog, and toast utilities
- โ
Local storage helper using
SharedPreferences - โ Stopwatch & timer utilities
- โ
isDebug()andisRelease()environment helpers - โ CLI-powered JSON โ Dart model generator
- โ ๐ Auth boilerplate generator (BLoC) via CLI
- โ Supports Firebase and REST API authentication
๐ฆ Installation
Add this to your pubspec.yaml:
dependencies:
quicklit: ^0.0.1
Then run:
flutter pub get
๐ CLI Usage (v1.1.0)
The Quicklit CLI Tool v1.1.0 supports model generation, auth boilerplate scaffolding, and dependency setup.
๐ง Commands
dart run quicklit:model_gen <json_file> --class <ClassName>
dart run quicklit:model_gen --get-login [--firebase | --api]
dart run quicklit:model_gen --install-deps
๐งช Examples
๐ JSON Model Generation
dart run quicklit:model_gen user.json --class UserModel
๐ Auth Boilerplate (BLoC-based)
dart run quicklit:model_gen --get-login --firebase
dart run quicklit:model_gen --get-login --api
dart run quicklit:model_gen --get-login # Prompts to choose
โ๏ธ Install Dependencies
dart run quicklit:model_gen --install-deps
๐ Auth Providers
๐ API Auth
- RESTful API login/register
- JWT token support
- Customizable endpoints
- Dio client with interceptors
๐ฅ Firebase Auth
- Firebase Auth SDK integration
- Email/password login/register
- Built-in error handling
- Works with
google-services.json/GoogleService-Info.plist
๐ Auth Boilerplate Structure
lib/
โโโ pages/auth/
โ โโโ login.dart
โ โโโ register.dart
โโโ bloc/auth/
โ โโโ auth_bloc.dart
โ โโโ auth_event.dart
โ โโโ auth_state.dart
โโโ services/ # API only
โ โโโ auth_service.dart
โโโ models/ # API only
โโโ user_model.dart
๐จ Flutter Usage
โ Auth Screens
import 'package:quicklit/quicklit.dart';
void main() {
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: QuicklitLoginPage(), // or QuicklitRegisterPage()
));
}
๐จ Theme Toggle
QuicklitThemeToggle()
๐ Internet Connection Checker
QuicklitConnectionChecker(
onOnline: () => print('Connected'),
onOffline: () => print('Disconnected'),
)
๐ Utility Functions
๐ Local Storage
await QuicklitStorage.saveString('username', 'shreyash');
String? name = await QuicklitStorage.getString('username');
๐ Timer & Stopwatch
final stopwatch = QuicklitStopwatch();
stopwatch.start();
await Future.delayed(Duration(seconds: 2));
stopwatch.stop();
print(stopwatch.elapsed);
QuicklitTimer.delay(Duration(seconds: 3), () {
print('Executed after 3 seconds');
});
๐งช Environment Helpers
if (QuicklitUtils.isDebug()) {
print('Debug mode');
}
๐ Dependencies
Base
connectivity_plusshared_preferencesproviderflutter_blocequatablehttpjson_annotationbuild_runnerjson_serializable
Firebase
firebase_authfirebase_core
API
diopretty_dio_logger
๐ฏ Full Example App
See /example/ directory for complete usage.
๐ค Contributing
We welcome contributions:
- Fork the repo
- Create your branch (
git checkout -b feature/new-feature) - Commit your changes (
git commit -m 'Add something') - Push (
git push origin feature/new-feature) - Open a Pull Request
๐ License
MIT License โ see LICENSE
๐ Links
- GitHub: shreyasgajbhiye/quicklit
- Pub.dev: Quicklit Package