๐Ÿ”ฅ Quicklit

pub package License: MIT

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() and isRelease() environment helpers

  • โœ… CLI-powered JSON โ†’ Dart model generator (with .g.dart support)

    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) default

    Examples:

    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 storage
  • connectivity_plus - For internet connection checking
  • json_annotation - For JSON serialization

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

pub package
License: MIT

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() and isRelease() 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_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:

  1. Fork the repo
  2. Create your branch (git checkout -b feature/new-feature)
  3. Commit your changes (git commit -m 'Add something')
  4. Push (git push origin feature/new-feature)
  5. Open a Pull Request

๐Ÿ“„ License

MIT License โ€“ see LICENSE



Libraries

quicklit