/dartpedia

Wikipedia API Wrapper written in Dart

Primary LanguageDartMIT LicenseMIT

An API Wrapper for the MediaWiki API

Created by Benjamin Whitehead

pub package Build Status

This is an early implementation of the MediaWiki API in Dart. Note, there are still some issues with this API that will be worked on in the coming months. Some of these issues include: unclean data and over use of dynamic types.

Getting Started

To get started, simply add dartpedia to pubspec.yaml:

dependencies:
  dartpedia: ^1.6.0

Using

To use dartpedia, first start by importing the package.

import 'package:dartpedia/dartpedia.dart' as wiki;

Next, create a new WikipediaPage object with the wiki.page(topic) function.

var wikipediaPage = await wiki.page('Dart (programming language)');

Use the .summary() function to print a summary of the page.

print(wikipediaPage.summary());

To get the individual components of a page, use the following functions

var url = wikipediaPage.url;
var title = wikipediaPage.title;
var links = wikipediaPage.links;
var content = wikipediaPage.content;

To search for possible topics for a phrase, use the .search(topic) function

var relatedTopics = await wiki.search("Dart");
print(relatedTopics);

Examples:

More examples can be found in the Examples folder