zeba_quiz_engine

A powerful and flexible Flutter quiz engine for building educational apps, mock tests, assessments, examinations, and e-learning platforms.

zeba_quiz_engine provides support for multiple question types, timed exams, negative marking, progress tracking, result analytics, and question randomization out of the box.

Features

✅ Multiple Choice Questions (MCQ)

✅ True / False Questions

✅ Match the Following Questions

✅ Timed Exams

✅ Negative Marking Support

✅ Progress Tracking

✅ Result Analytics

✅ Question Randomization

✅ Flutter Web Support

✅ Android, iOS, Windows, macOS & Linux Support

✅ Null Safety


Installation

Add the package to your pubspec.yaml:

dependencies:
  zeba_quiz_engine: ^0.1.0

Then run:

flutter pub get

Import

import 'package:zeba_quiz_engine/zeba_quiz_engine.dart';

Quick Start

Create Questions

final questions = [
  Question(
    id: '1',
    question: 'Flutter is developed by?',
    type: QuestionType.mcq,
    options: [
      'Google',
      'Apple',
      'Microsoft',
      'Meta',
    ],
    correctIndex: 0,
    marks: 4,
    negativeMarks: 1,
  ),
];

Initialize Quiz Engine

final quizEngine = QuizEngine(
  questions: questions,
);

Submit Answers

quizEngine.submitAnswer(
  '1',
  0,
);

Evaluate Results

final result = quizEngine.evaluate();

print(result.score);
print(result.correct);
print(result.wrong);

MCQ Example

McqQuestionWidget(
  question: question.question,
  options: question.options!,
  selected: selectedAnswer,
  onChanged: (value) {
    setState(() {
      selectedAnswer = value;
    });
  },
)

True / False Example

TrueFalseQuestionWidget(
  question: question.question,
  selected: selectedAnswer,
  onChanged: (value) {
    setState(() {
      selectedAnswer = value;
    });
  },
)

Match the Following Example

MatchQuestionWidget(
  pairs: question.matchPairs!,
)

Timed Exams

final timer = QuizTimer(
  const Duration(minutes: 30),
);

timer.start();

Question Randomization

final randomizedQuestions =
    QuestionRandomizer.shuffle(
      questions,
    );

Progress Tracking

QuizProgressIndicator(
  current: currentQuestion,
  total: totalQuestions,
)

Result Analytics

final result = quizEngine.evaluate();

print('Score: ${result.score}');
print('Correct: ${result.correct}');
print('Wrong: ${result.wrong}');
print('Percentage: ${result.percentage}');

Supported Question Types

Type Supported
MCQ
True / False
Match the Following

Roadmap

  • Question Review Screen
  • Bookmark Questions
  • Quiz Persistence
  • Leaderboards
  • Exam Resume Support
  • Advanced Analytics
  • Localization
  • Custom Themes
  • Riverpod Integration
  • BLoC Integration

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

You may copy, modify, and distribute this software under the terms of the GPL license.

See the LICENSE file for details.


About Me

✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.

You can learn more about me and my work at sufyanism.com or connect with me on LinkedIn.


Your all-in-one learning hub!

🚀 Explore courses and resources in coding, tech, and development at zeba.academy and code.zeba.academy.

Empower yourself with practical skills through curated tutorials, real-world projects, and hands-on experience.

Level up your tech game today! 💻✨

Zeba Academy is a learning platform dedicated to coding, technology, and development.

➡ Visit our main site: https://zeba.academy

➡ Explore courses and resources: https://code.zeba.academy

➡ YouTube: https://www.youtube.com/@zeba.academy

➡ Instagram: https://www.instagram.com/zeba.academy/


⭐ If you find this package useful, consider starring the repository and sharing it with the Flutter community.

Thank you for supporting open source!

Libraries

zeba_quiz_engine