quicklit 0.1.1
quicklit: ^0.1.1 copied to clipboard
A blazing-fast Flutter toolkit with essential utilities and UI components for hackathon-ready apps.
π₯ 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.dart
support)
π¦ Installation #
Add this to your pubspec.yaml
:
dependencies:
quicklit: ^0.0.1
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 (v0.1.1) #
The Quicklit CLI Tool v0.1.1
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_plus
shared_preferences
provider
flutter_bloc
equatable
http
json_annotation
build_runner
json_serializable
Firebase #
firebase_auth
firebase_core
API #
dio
pretty_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