twitter_1user 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

twitter 1user #

pub package

Connect to Twitter API with OAuth1.0a. The access token is assumed to be obtained from the Twitter application details page. It is therefore ideal for single user applications.

Install #

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

dependencies:
  twitter_1user: ^1.0.1

You can install packages from the command line.

pub get

Example #

import 'package:twitter_1user/twitter_1user.dart';

main(List<String> arguments) async {
  Twitter twitter = new Twitter('CONSUMER KEY', 'CONSUMER SECRET',
      'ACCESS TOKEN', 'ACCESS TOKEN SECRET');

  String response = await twitter.request(
      'get', 'statuses/user_timeline.json', {});
  var tweets = jsonDecode(response);
  print(tweets[2]);

  response =
  await twitter.request('post', 'statuses/update.json', {'status': 'Hello!'});
  print(response);
}

LICENSE #

MIT

1.0.0 #

  • Initial version, created by Stagehand

example/example.dart

import 'dart:io' show Platform;
import 'dart:convert';
import 'package:twitter_1user/twitter_1user.dart';

Future<void> main(List<String> arguments) async {
  Map<String, String> env = Platform.environment;
  Twitter twitter = new Twitter(env['API_KEY'], env['API_SECRET'],
      env['ACCESS_TOKEN'], env['ACCESS_SECRET']);

  String response = await twitter
      .request('GET', 'statuses/user_timeline.json', {'trim_user': 'true'});
  var tweets = jsonDecode(response);
  print(tweets[1]['text']);

  response = await twitter
      .request('post', "statuses/update.json", {'status': 'Hello, ワールド!'});
  print(response);
}

Use this package as a library

1. Depend on it

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


dependencies:
  twitter_1user: ^1.0.1

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:twitter_1user/twitter_1user.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Dec 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Health issues and suggestions

Document public APIs. (-1 points)

11 out of 11 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/twitter_1user.dart. (-3.45 points)

Analysis of lib/twitter_1user.dart reported 7 hints, including:

line 40 col 31: Unnecessary new keyword.

line 44 col 23: Unnecessary new keyword.

line 56 col 23: Unnecessary new keyword.

line 57 col 24: Unnecessary new keyword.

line 58 col 44: Unnecessary new keyword.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
convert ^2.1.1 2.1.1
crypto ^2.1.2 2.1.4
Transitive dependencies
charcode 1.1.2
collection 1.14.12
typed_data 1.1.6
Dev dependencies
pedantic ^1.7.0
test ^1.5.0