πŸ”₯ 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