dad-jokes- pub package

A Dart package for getting random dad jokes from The dad_joke package in Flutter provides a simple and fun way to incorporate dad jokes into your app. It connects to the icanhazdadjoke API to fetch random jokes and display them in your app. With a few lines of code, you can add a touch of humor to your app and entertain your users with dad jokes that are sure to make them smile. Whether you're creating a lighthearted app or just want to add some fun to your existing app, the dad_joke package is a great choice.


To use this package, add dad_jokes as a dependency in your pubspec.yaml file.


Screenshot 1


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

void main() {
  runApp(const MyApp());

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

  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Get Dad Joke',
      theme: ThemeData(
      home: const HomeScreen(),

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

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        actions: [
            onPressed: () {},
            icon: const Icon(Icons.share),
            onPressed: () {},
            icon: const Icon(Icons.favorite_border),
      body: const SizedBox(
        child: DadJoke(
          // All fields are optional
          backgroundColor: Colors.white, // get Background Color
          reloadIcon: Icons.replay_outlined, // get Icon to show
          reloadIconColor:, // get Icon Color
          onLoadView: CircularProgressIndicator(), // get Loader to show
          onLoadViewColor:, // get loader color
          width: 300, // get width of the card


Parameter Type Description
backgroundColor Color? Background color of the joke card.
reloadIcon IconData? Icon to show when the joke is loading.
reloadIconColor Color? Color of the reload icon.
onLoadView Widget? Widget to show when the joke is loading.
onLoadViewColor Color? Color of the loading widget.
width double? Width of the joke card.

Also Need Package

Package Description
http A composable, Future-based library for making HTTP requests.

Github Repository

Dad Jokes


Shubham Kumar - Github

Also See

Package Description
Single Text Field A Flutter package for creating a single text field.
Drop Down List Menu A Flutter package for creating a drop down list menu.