rednit 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 61

rednit #

A Dart wrapper for the Reddit API, built primarily for use with Flutter.

Installing #

Add rednit as a dependency in your pubspec.yaml file

dependencies:
  rednit: <version>

Usage #

When using this package you will mainly be using a RedditClient instance, which should be created using the default constructor (future versions may include more than one constructor). This client instance has the necessary data members and methods used for accessing the Reddit API.

Example #

An example can be found in the example folder showing how to use the RedditClient.

0.3.0 #

Breaking: Create getSubredditFeed and remove subreddit parameter from getFeed.

Add dependency on json_serializable for parsing response from REST API.

Add methods for getting user, user submissions, and user comments.

0.2.0 #

Breaking

Replace Credentials class with two options for different use cases - InstalledAppCredentials and ScriptAppCredentials.

0.1.0+1 #

Update README.

0.1.0 #

Initial pub release.

example/README.md

An example implementation of Rednit as a console application. Useful for developing new features for Rednit.

Getting started #

To try it out yourself, you first need to have a Reddit account and create a Reddit application (of type script) at https://www.reddit.com/prefs/apps/. This will give you access to a Client ID and a Client secret, which is required to use Reddit's APIs from a script.

Then you have to create the file bin/secrets/reddit_constants.dart and declare the class below, with your own client ID, client secret, username and password.

class RedditConstants {
  static const clientId = '<YOUR_CLIENT_ID>';
  static const clientSecret = '<YOUR_CLIENT_SECRET>';
  static const username = '<YOUR_REDDIT_USERNAME>';
  static const password = '<YOUR_REDDIT_PASSWORD>';
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  rednit: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:rednit/rednit.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
84
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:rednit/rednit.dart that imports:
  • package:rednit/src/query.dart that imports:
  • package:rednit/src/auth/auth.dart that imports:
  • package:rednit/src/http_client.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:rednit/rednit.dart that imports:
  • package:rednit/src/query.dart that imports:
  • package:rednit/src/auth/auth.dart that imports:
  • package:rednit/src/http_client.dart that imports:
  • dart:io

Health suggestions

Fix lib/src/model/link.g.dart. (-1.99 points)

Analysis of lib/src/model/link.g.dart reported 4 hints:

line 33 col 22: The declaration '_$LinkToJson' isn't referenced.

line 64 col 22: The declaration '_$ImagesPreviewToJson' isn't referenced.

line 82 col 22: The declaration '_$PreviewThingToJson' isn't referenced.

line 96 col 22: The declaration '_$PreviewImageToJson' isn't referenced.

Fix lib/src/model/comment.g.dart. (-1 points)

Analysis of lib/src/model/comment.g.dart reported 2 hints:

line 19 col 22: The declaration '_$MoreCommentToJson' isn't referenced.

line 42 col 22: The declaration '_$TextCommentToJson' isn't referenced.

Fix lib/src/model/listing.g.dart. (-0.50 points)

Analysis of lib/src/model/listing.g.dart reported 1 hint:

line 17 col 22: The declaration '_$ListingToJson' isn't referenced.

Fix lib/src/model/subreddit.g.dart. (-0.50 points)

Analysis of lib/src/model/subreddit.g.dart reported 1 hint:

line 20 col 22: The declaration '_$SubredditToJson' isn't referenced.

Fix lib/src/model/user.g.dart. (-0.50 points)

Analysis of lib/src/model/user.g.dart reported 1 hint:

line 27 col 22: The declaration '_$UserToJson' isn't referenced.

Maintenance suggestions

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
build_config ^0.4.2 0.4.2
http ^0.12.0 0.12.1
json_annotation ^3.0.0 3.0.1
meta ^1.1.8 1.2.2 1.3.0-nullsafety
uuid ^2.0.4 2.2.0
Transitive dependencies
charcode 1.1.3
checked_yaml 1.0.2
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
http_parser 3.1.4
path 1.7.0
pedantic 1.9.2
pub_semver 1.4.4
pubspec_parse 0.1.5
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
yaml 2.2.1
Dev dependencies
build_runner ^1.10.0
json_serializable ^3.3.0
mockito ^4.1.1
test ^1.15.0