Reddit class
The Reddit class provides access to Reddit's API and stores session state for the current Reddit instance. This class contains objects that can be used to interact with Reddit posts, comments, subreddits, multireddits, and users.
Constructors
Properties
- auth → Authenticator
-
The authorized client used to interact with Reddit APIs.
no setter
- config → DRAWConfigContext
-
The configuration for the current Reddit instance.
no setter
- front → FrontPage
-
Provides methods to retrieve content from the Reddit front page.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- inbox → Inbox
-
no setter
- objector → Objector
-
A utility class that converts Reddit API responses to DRAW objects.
no setter
- readOnly → bool
-
A flag representing whether or not this Reddit instance can only make
read requests.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subreddits → Subreddits
-
Provides methods to interact with sets of subreddits.
no setter
- user → User
-
Provides methods for the currently authenticated user.
no setter
Methods
-
comment(
{String? id, dynamic url}) → CommentRef - Creates a lazily initialized CommentRef.
-
delete(
String api, {Map< String, String> ? body}) → Future -
get(
String api, {Map< String, String?> ? params, bool objectify = true, bool followRedirects = false}) → Future -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
post(
String api, Map< String, String?> ? body, {Map<String, Uint8List?> ? files, Map? params, bool discardResponse = false, bool objectify = true}) → Future -
put(
String api, {Map< String, String> ? body}) → Future -
redditor(
String redditor) → RedditorRef -
submission(
{String? id, dynamic url}) → SubmissionRef - Creates a lazily initialized SubmissionRef.
-
subreddit(
String subreddit) → SubredditRef -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- defaultCommentKind → String
-
The default object kind mapping for Comment.
final
- defaultMessageKind → String
-
The default object kind mapping for Message.
final
- defaultOAuthApiEndpoint → String
-
The default Url for the OAuthEndpoint
final
- defaultRedditorKind → String
-
The default object kind mapping for Redditor.
final
- defaultSubmissionKind → String
-
The default object kind mapping for Submission.
final
- defaultSubredditKind → String
-
The default object kind mapping for Subreddit.
final
- defaultTrophyKind → String
-
The default object kind mapping for Trophy.
final
Static Methods
-
createInstalledFlowInstance(
{String? clientId, String? userAgent, Uri? redirectUri, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Reddit -
Creates a new Reddit instance for use with the installed application
authentication flow. This instance is not authenticated until a valid
response code is provided to
WebAuthenticator.authorize
(see test/auth/web_auth.dart for an example usage). -
createReadOnlyInstance(
{String? clientId, String? clientSecret, String? userAgent, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Future< Reddit> -
Creates a new read-only
Reddit
instance for web and script applications. -
createScriptInstance(
{String? clientId, String? clientSecret, String? userAgent, String? username, String? password, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Future< Reddit> -
Creates a new authenticated
Reddit
instance for use with personal use scripts. -
createUntrustedReadOnlyInstance(
{String? clientId, String? deviceId, String? userAgent, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Future< Reddit> -
Creates a new read-only
Reddit
instance for installed application types. -
createWebFlowInstance(
{String? clientId, String? clientSecret, String? userAgent, Uri? redirectUri, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Reddit -
Creates a new Reddit instance for use with the web authentication flow.
This instance is not authenticated until a valid response code is
provided to
WebAuthenticator.authorize
(see test/auth/web_auth.dart for an example usage). -
restoreAuthenticatedInstance(
String credentialsJson, {String? clientId, String? clientSecret, String? userAgent, Uri? redirectUri, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Reddit -
Creates a new Reddit instance for use with the web authentication flow.
This instance is not authenticated until a valid response code is
provided to
WebAuthenticator.authorize
(see test/auth/web_auth.dart for an example usage). -
restoreInstalledAuthenticatedInstance(
String credentialsJson, {String? clientId, String? clientSecret, String? userAgent, Uri? redirectUri, Uri? tokenEndpoint, Uri? authEndpoint, Uri? configUri, String siteName = 'default'}) → Reddit - Creates a new installed Reddit instance from cached credentials.