dartpedia 1.0.2 copy "dartpedia: ^1.0.2" to clipboard
dartpedia: ^1.0.2 copied to clipboard

discontinued
outdated

API Wrapper for the MediaWiki API. Used to gather information from any Wikipedia Page.

An API Wrapper for the MediaWiki API

Created by Benjamin Whitehead

pub package

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.0.1

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;

Examples #

Get all unique words in a Wikipedia page: #

import 'package:dartpedia/dartpedia.dart' as wiki;
main() async {
  var words = [];
  try {
    var page = await wiki.page('New York City');
    var pageContents = ((page.content).split(' '));
    pageContents.forEach((e) {
      if (!words.contains(e)) {
        words.add(e);
      }
    });
  } catch (exception) {
    print(exception);
  }
  print(words);
}

More examples can be found in the Examples folder

Future Plans: #

  1. Rewrite WikipediaAPI class, get rid of all dynamics for more type safety (hopefully).
    1. Also continue to clean up data given by API
  2. Implement Topic Search:
    • Search for a title or text.
    • Search for wiki pages near a location.
    • Prefix Search Functionality
7
likes
0
pub points
19%
popularity

Publisher

unverified uploader

API Wrapper for the MediaWiki API. Used to gather information from any Wikipedia Page.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

dio, flutter, test

More

Packages that depend on dartpedia