instagram 1.0.0

  • Installing
  • Versions
  • 70



NOTE: The old Instagram API is now deprecated; this package will now focus on the Instagram Graph API.

Dart Instagram client library. This library includes support for authentication, as well as all of the Instagram API v1 endpoints.

The API is entirely documented, for convenience. 👍

Users of Angel can use package:angel_auth_instagram to authenticate users with Instagram.

Coming soon: Subscriptions


Via Access Token

If you already have an access token, you can authenticate a client.

Note: The user property of the InstagramClient will be null.

var client = InstagramApiAuth.authorizeViaAccessToken('<access-token>');
var me = await client.users.self.get();


To perform authentication, use the InstagramApiAuth class. All API scopes are included as InstagramApiScope constants for convenience.

var auth = new InstagramApiAuth('<client-id>', '<client-secret>',
  redirectUri: Uri.parse('<redirect-uri>'),
  scopes: [
    // ...

Implicit Auth

Applications with no server-side component can implement implicit auth.

To get a redirect URI:

var redirectUri = auth.getImplicitRedirectUri();
window.location.href = redirectUri.toString();

Explicit Auth

This library also supports traditional OAuth2 authentication.

To obtain a redirect URI:

var redirectUri = auth.getRedirectUri();
var redirectUri = auth.getRedirectUri(state: '');

After you have obtained an authorization code, you can exchange it for an access token, and receive an InstagramClient.

This example is an Angel handler:

app.get('/auth/instagram/callback', (RequestContext req, InstagramApiAuth instaAuth) async {
  var client = await instaAuth.handleAuthorizationCode(req.query['code'], new http.Client());
  var me = await client.users.self.get();
  // Do something with the authenticated user...

You can also manage subscriptions:

main() {
  var subscriptions = instaAuth.createSubscriptionManager(new http.Client());


The InstagramClient contains several getters that correspond to endpoints. Each is an abstraction over a specific Instagram API.

Here is an example with the relationships API:

Future<bool> userFollowsMe(String userId, InstagramClient instagram) async {
  var relationship = await instagram.relationships.toUser(userId).get();
  return relationship.incomingStatus == IncomingStatus.followedBy;


This API includes several classes containing helpful constants:

  • InstagramApiScope
  • IncomingStatus
  • OutgoingStatus
  • RelationshipAction
  • MediaType
  • SubscriptionObject
  • SubscriptionAspect

Use this package as a library

1. Depend on it

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

  instagram: "^1.0.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

      import 'package:instagram/instagram.dart';
Version Uploaded Documentation Archive
1.0.0 Jul 11, 2018 Go to the documentation of instagram 1.0.0 Download instagram 1.0.0 archive
1.0.0-rc.1 Jul 23, 2017 Go to the documentation of instagram 1.0.0-rc.1 Download instagram 1.0.0-rc.1 archive
1.0.0-beta+3 Jul 20, 2017 Go to the documentation of instagram 1.0.0-beta+3 Download instagram 1.0.0-beta+3 archive
1.0.0-beta+2 Jul 18, 2017 Go to the documentation of instagram 1.0.0-beta+2 Download instagram 1.0.0-beta+2 archive
1.0.0-beta+1 Jul 18, 2017 Go to the documentation of instagram 1.0.0-beta+1 Download instagram 1.0.0-beta+1 archive
1.0.0-beta Jul 18, 2017 Go to the documentation of instagram 1.0.0-beta Download instagram 1.0.0-beta archive


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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
59 / 100
Code health derived from static analysis. [more]
84 / 100
Reflects how tidy and up-to-date the package is. [more]
78 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:instagram/instagram.dart.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 errors 52 hints.

    Strong-mode analysis of lib/src/models/models.g.dart failed with the following error:

    line: 190 col: 15
    The argument type '(Map<String, dynamic>) → UserInPhoto' can't be assigned to the parameter type '(dynamic) → dynamic'.

    Run dartfmt to format lib/instagram.dart.

    Similar analysis of the following files failed:

    • lib/src/api/api.dart (hint)
    • lib/src/api/comment.dart (hint)
    • lib/src/api/instagram.dart (hint)
    • lib/src/api/like.dart (hint)
    • lib/src/api/media.dart (hint)
    • lib/src/api/relationships.dart (hint)
    • lib/src/api/subscription.dart (hint)
    • lib/src/endpoints.dart (hint)
    • lib/src/instagram.dart (hint)
    • lib/src/models/impl_models.g.dart (hint)
    • lib/src/models/models.dart (hint)
    • lib/src/requestor.dart (hint)
  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use instagram.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
oauth2 ^1.0.0 1.2.1
owl ^0.2.1 0.2.2
Transitive dependencies
async 2.0.7
charcode 1.1.2
collection 1.14.10
convert 2.0.1
crypto 2.0.5
http 0.11.3+17
http_parser 3.1.2
path 1.6.1
postgresql 0.3.4+1
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
build_runner ^0.3.0
owl_codegen ^0.2.1
test ^0.12.0