flutter_linkedin_login 2.4.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

flutter_linkedin_login #

A Flutter plugin for Sign in with LinkedIn


LinkedIn is discontinuing their mobile SDKs, which this plugin depends on. iOS 12 seems to already be not working anymore. The LinkedIn app, doesn't ask for 3rd party app permissions like it used to. Support will end March 2019. The fate of this plugin is undetermined. It may be redesigned to use LinkedIn's OAuth 2.0 APIs. Stay tuned. See [https://engineering.linkedin.com/blog/2018/12/developer-program-updates]

Installation #

See the installation instructions on pub

Android #

Follow the "Associate your Android app with your LinkedIn app" section of LinkedIn's Getting started with Android. Find your package name in the android/app/src/main/AndroidManifest.xml file. For the debug key hash value generation, remember to use 'android' as your password. Click update after adding your package and key in LinkedIn's developer console for your changes to take.

Open your MainActivity in your Android app/src/main/ directory and override the onActivityResult method with the following

import android.content.Intent
import io.tuantvu.flutterlinkedinlogin.FlutterLinkedinLoginPlugin

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
  FlutterLinkedinLoginPlugin.onActivityResult(this, requestCode, resultCode, data)
  super.onActivityResult(requestCode, resultCode, data)

import android.content.Intent
import io.tuantvu.flutterlinkedinlogin.FlutterLinkedinLoginPlugin

public void onActivityResult(int requestCode, int resultCode, Intent data) {
  FlutterLinkedinLoginPlugin.onActivityResult(this, requestCode, resultCode, data);
  super.onActivityResult(requestCode, resultCode, data);

iOS #

  • May not work with iOS 12

Follow the "Associate your iOS app with your LinkedIn app" section of LinkedIn's Getting started with iOS.

Open your AppDelegate in your ios/Runner directory and add the following function

//add #import <flutter_linkedin_login/FlutterLinkedinLoginPlugin.h>
//to your Running-Bridging-Header.h file
override func application(_ app: UIApplication, open: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    if (FlutterLinkedinLoginPlugin.shouldHandle(open)) {
        return FlutterLinkedinLoginPlugin.application(app, open: open, sourceApplication: nil, annotation: nil)
    return true
//add #import <flutter_linkedin_login/FlutterLinkedinLoginPlugin.h> at top of your AppDelegate.m
- (BOOL)application:(UIApplication *)application open:(NSURL *)open options:(UIApplicationOpenURLOptionsKey *)options {
    if ([FlutterLinkedinLoginPlugin shouldHandleUrl:url]) {
        return [FlutterLinkedinLoginPlugin application:application open:open sourceApplication:nil annotation: nil];
    return YES;

Usage #

See the example

Methods #

loginBasic()Log in with basic profile"Logged in" or "Access token still valid"
getProfile()Retrieves profile with whatever permissions were asked for during log inLinkedInProfile
loginBasicWithProfile()Convenience method that logs in with basic profile and returns the profileLinkedInProfile
accessToken()Returns current access tokenLinkedInAccessToken
logout()Logs out"Cleared session" or "No session"

Widgets #

LinkedInSignInButtonButton that calls loginBasicWithProfile(). To get the profile, pass in argument onSignIn: (profile, ex){...}Sign In with LinkedIn

LinkedInProfile #

  String firstName;
  String lastName;
  String headline;
  String id;
  String pictureUrl;
  String summary;
  String industry;
  String emailAddress;
  String formattedName;
  LinkedInLocation location;
  List<LinkedInPosition> positions;
  String publicProfileUrl;

Additional API calls #

Submit an issue if you would like to see additional LinkedIn APIs exposed. This simple implementation was enough for my purposes.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v2.4.0 - 2018-12-16 #

Added #

  • accessToken retrieval function

v2.3.0 - 2018-12-15 #

Added #

  • publicProfileUrl
  • location in positions

v2.2.1 - 2018-12-13 #

Updated #

  • ext.kotlin_version = '1.2.71'

v2.2.0 - 2018-12-10 #

Added #

  • LinkedInPositions

v2.1.0 - 2018-09-09 #

Added #

  • LinkedInSignInButton

v2.0.0 - 2018-09-09 #

Added #

  • loginBasicWithProfile()

Removed #

  • static getters for login, profile, and clearSession

v1.1.0 - 2018-09-09 #

Added #

  • emailAddress, formattedName, and location to LinkedInProfile
  • toJson() for LinkedInProfile
  • methods loginBasic(), logout(), and getProfile() in preparation to remove getters

v1.0.0 - 2018-07-22 #

Added #

  • Support for iOS

Changed #

  • Android check session valid before getting profile

v0.1.1 - 2018-07-22 #

Changed #

  • Android MainActivity must override onActivityResult

v0.0.1 - 2018-07-04 #

Added #

  • Support for Android


import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_linkedin_login/flutter_linkedin_login.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

typedef Future<void> FutureCallBack();

class _MyAppState extends State<MyApp> {
  String _output = 'See output here';
  int navIndex = 0;

  _signInWithLinkedIn() async {
    _callPlatformService(() async {
      String status = await FlutterLinkedinLogin.loginBasic();
      debugPrint("_signInWithLinkedIn: $status");
      setState(() {
        _output = status;

  _getProfile() async {
    _callPlatformService(() async {
      LinkedInProfile profile = await FlutterLinkedinLogin.getProfile();
      debugPrint("profile: $profile");
      setState(() {
        _output = profile.toString();

  _logout() async {
    _callPlatformService(() async {
      String status = await FlutterLinkedinLogin.logout();
      debugPrint("_logout: $status");
      setState(() {
        _output = status;

  _accessToken() async {
    _callPlatformService(() async {
      LinkedInAccessToken accessToken = await FlutterLinkedinLogin.accessToken();
      debugPrint("_accessToken: $accessToken");
      setState(() {
        _output = accessToken.toString();

  _callPlatformService(FutureCallBack callback) async {
    try {
      await callback();
    } on PlatformException catch(e) {
      debugPrint("PlatformException code: ${e.code}, message: ${e.message}, toString: ${e.toString()}");
      setState(() {
        _output = "code: ${e.code}, message: ${e.message}";
    } catch (error) {
      debugPrint("error: $error");

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('LinkedIn Login Plugin Example'),
        bottomNavigationBar: BottomNavigationBar(
          fixedColor: Colors.black54,
            currentIndex: navIndex,
            onTap: (index) {
              switch (index) {
                case 0: _signInWithLinkedIn(); break;
                case 1: _getProfile(); break;
                case 2: _accessToken(); break;
                case 3: _logout(); break;
              setState(() {
                navIndex = index;
            items: <BottomNavigationBarItem>[
              navItem(iconData: Icons.accessibility, title: "Login"),
              navItem(iconData: Icons.person, title: "Profile"),
              navItem(iconData: Icons.vpn_key, title: "Token"),
              navItem(iconData: Icons.exit_to_app, title: "Logout"),
        body: Center(
          child: new ListView(
            children: <Widget>[
              new LinkedInSignInButton(onSignIn: (profile, ex) {
                if (profile != null) {
                  debugPrint("profile: $profile");
                  setState(() {
                    _output = profile.firstName;
                } else {
                  debugPrint("exception: $ex");
                  setState(() {
                    _output = "code: ${ex.code}, message: ${ex.message}";
              Divider(height: 4.0,),
              new Text('Output', textAlign: TextAlign.center, textScaleFactor: 1.5,),
              SizedBox(height: 16.0,),
                padding: const EdgeInsets.all(8.0),
                child: new Text('$_output\n',),

  BottomNavigationBarItem navItem({IconData iconData, String title}) {
    return BottomNavigationBarItem(
      icon: Icon(iconData, color: Colors.black54,),
        title: Text(title, style: TextStyle(color: Colors.black54),),

Use this package as a library

1. Depend on it

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

  flutter_linkedin_login: ^2.4.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support 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:flutter_linkedin_login/flutter_linkedin_login.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health issues and suggestions

Document public APIs. (-0.37 points)

91 out of 93 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.

Format lib/flutter_linkedin_login.dart.

Run flutter format to format lib/flutter_linkedin_login.dart.

Format lib/linkedin_signin_button.dart.

Run flutter format to format lib/linkedin_signin_button.dart.

Maintenance suggestions

Package is getting outdated. (-43.56 points)

The package was last published 74 weeks ago.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8