A flutter search engine based on MediaWiki with caching

  Flutter App, Search
WikiSearch

Table of contents

Project Description

  • WikiSearch is a Flutter search engine which was build using BLoC/Cubit pattern and powered by the MediaWiki API.
  • It also uses the NewsApi to show the latest news in its homescreen.
  • WikiSearch also uses caching to improve UX, for caching we have used a NoSQL database called HiveDB.

Working

App Architecture

App Architecture

Application logic flow :

  1. When initiated either by a function call or initState, cubit receives this request.
  2. Then the cubit calls the repositories which further makes an API call to fetch this data.
  3. This data is stored in the cubit and once successful the cubit emits a suitable state and UI changes accordingly.
  4. If the data was fetched successfully it is cached using HiveDB.
  5. The UI is displayed according to these states.

BLoC/Cubit Pattern

BLoC is a state management solution for flutter. In this project, we have used cubit pattern.
Below is a diagramatic representation of how cubit pattern works :

To know more about BLoC: https://github.com/felangel/bloc

Caching using HiveDB

Flutter logo

Caching is used to improve the app’s performance in terms of UX, caching in this app was implemented using HiveDB.

Hive – Hive is a lightweight and blazing fast key-value database written in pure Dart.
Hive is a NoSQL database which has really great performance in terms of both write and read operations.

Data we are caching in this application:

  1. Search history (whatever keywords the user searched for).
  2. List of wiki articles that are being fetched from the MediaWiki API.

App UI

Project Setup

The basic steps you need to follow to get started with this project.

Requirements :

Step 1: Clone this repo

git clone https://github.com/Shashwat-Joshi/WikiSearch.git

Step 2: Run these commands in the project directory to download the required packages

flutter clean
flutter pub get

Step 3: To run the project in release

flutter run --release

To-Do

  •  Implementing pagination (star caching should only be done for top 10 results)
    •  Pagination for top news in home screen.
    •  Pagination for wiki search results
  •  Light Theme mode (first_quarter_moon)
  •  Connecting weather API
    •  Fetch data from weather API and display it on home screen.
    •  Cache weather data.
  •  Improving documentation (sweat_smile)

Download wikisearch source code on GitHub

https://github.com/Shashwat-Joshi/WikiSearch