coffee_required 0.0.1 copy "coffee_required: ^0.0.1" to clipboard
coffee_required: ^0.0.1 copied to clipboard

A humorous debug-only guard that enforces coding hours, break reminders, and coffee breaks with sarcastic or corporate overlay messages.

β˜• coffee_required #

Pub Version Likes Platform License: MIT

coffee_required Banner

Because running your app before coffee is a breaking change.

coffee_required is a humorous yet practical Flutter debug-only guard that helps you:

  • β›” Block coding before your brain boots (default: 9 AM).
  • πŸ’€ Warn about late-night commits (default: 11 PM).
  • 🧘 Enforce healthy breaks during long sessions.
  • 😏 Roast you with sarcastic logs and overlays.

Coffee Overlay Mockup

✨ Why coffee_required? #

Every developer has done one of these:

  1. Started debugging at 7:30 AM with zero caffeine.
  2. Shipped a bug at 1:42 AM because "it worked on my machine".
  3. Fixed something that wasn't broken.

coffee_required acts as a lightweight development gate that nudges you toward better habitsβ€”with sarcasm and β˜•.

Important

Safety Guarantee: All logic is strictly guarded by kDebugMode || kProfileMode. In release builds, every method becomes a no-op to ensure zero impact on production apps.


πŸš€ Features #

⏰ Time-Based Coffee Gate #

Block or warn when starting the app too early.

CoffeeRequired.ensure();

β˜• β€œIt’s 07:42. Your brain is still compiling.”

πŸ‘” "Corporate" Mode (New!) #

Passive-aggressive messages for the office environment.

CoffeeConfig(roastLevel: CoffeeRoastLevel.corporate);

πŸ“‹ β€œPer company policy, coding before coffee is not optimized for synergy.”

πŸ’¬ Custom Team Roasts #

Inject your own team's inside jokes.

CoffeeConfig(
  customMessages: {
    CoffeeSituation.beforeMinHour: ["Dave, go back to sleep."],
  },
);

πŸ§‹ "I Had Coffee" Override #

Bypass the gate for a configurable duration. Perfect for when you promise you are awake.


πŸ“¦ Installation #

Add this to your pubspec.yaml:

dependencies:
  coffee_required: ^1.0.0

πŸ§ͺ Usage #

Call before runApp():

import 'package:coffee_required/coffee_required.dart';
import 'package:flutter/material.dart';

void main() {
  // 1. Initialize
  CoffeeRequired.init(
    config: const CoffeeConfig(
      mode: CoffeeMode.warnOnly, // or blockApp
      minHour: 9, 
      maxHour: 23,
      roastLevel: CoffeeRoastLevel.sarcastic, // polite, sarcastic, savage, corporate
    ),
  );

  // 2. Enforce the gate
  CoffeeRequired.ensure();
  
  // 3. Optional: Start break reminders
  CoffeeRequired.remindBreaks();

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'My App',
      // ⚠️ IMPORTANT: Add the navigatorKey to see overlays!
      navigatorKey: CoffeeRequired.navigatorKey, 
      home: const Scaffold(body: Center(child: Text("Hello World"))),
    );
  }
}

βš™οΈ Configuration #

CoffeeConfig allows full customization:

Property Type Default Description
enabled bool true Turn off if you dislike fun.
mode CoffeeMode blockApp blockApp (throws), warnOnly (overlay).
minHour int 9 Hour before which coding is forbidden.
roastLevel CoffeeRoastLevel sarcastic Tone of the messages.
customMessages Map null Your own message overrides.
allowOverride bool true Allow the "I had coffee" button.

πŸ›‘οΈ License #

MIT License. Use it, fork it, roast your team with it.


Built with β˜• and Flutter by Maher-Tec.
2
likes
160
points
80
downloads

Publisher

unverified uploader

Weekly Downloads

A humorous debug-only guard that enforces coding hours, break reminders, and coffee breaks with sarcastic or corporate overlay messages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on coffee_required