draw 0.1.1 draw: ^0.1.1 copied to clipboard
A Reddit API wrapper for Dart, inspired by PRAW.
DRAW: The Dart Reddit API Wrapper #
DRAW, also known as the Dart Reddit API Wrapper, is a Dart package that provides simple access to the Reddit API. DRAW is inspired by PRAW, the Python Reddit API Wrapper, and aims to also maintain a similar interface.
This project is in early stages, but is in active development. Check back soon for more info!
Disclaimer: This is not an official Google product.
Installation #
Installing DRAW is simple using Dart's package management system, pub. Instructions on how to import DRAW into your project can be found here. If you would prefer to live on the hemorrhaging-edge, methods to depend on a local copy of DRAW or on the Github repository can be found here.
Getting Started #
Assuming you already have your Reddit OAuth credentials, getting started with DRAW is simple:
import 'dart:async';
import 'package:draw/draw.dart';
Future main() async {
// Create the `Reddit` instance and authenticate
Reddit reddit = await Reddit.createInstance(
clientId: CLIENT_ID,
clientSecret: SECRET,
userAgent: AGENT_NAME,
username: "DRAWApiOfficial",
password: "hunter12", // Fake
);
// Retrieve information for the currently authenticated user
Redditor currentUser = await reddit.user.me();
// Outputs: My name is DRAWApiOfficial
print("My name is ${currentUser.displayName}");
}
This simple example is a great way to confirm that DRAW is working and that your credentials have been configured correctly.
License #
DRAW is provided under a BSD 3-clause license. Copyright (c), 2017, the DRAW Project Authors and Google LLC.