flutter_linkedin 1.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • new70

flutter_linkedin #

  • A Flutter Package to login and get Profile Details from linkedIn.

Getting Started #

Initialize LinkedInLogin class

  final String redirectUrl = 'https://smarttersstudio.com';
  final String clientId = '78el5r2y1dwp4j ';
  final String clientSecret = 'RnyXiCNz3cahNx1g ';
  
  @override
  void initState() {
    LinkedInLogin.initialize(context,
      clientId: clientId,
      clientSecret: clientSecret,
      redirectUri: redirectUrl
    );
    super.initState();
  }

Get The Token From LinkedIn

	LinkedInLogin.loginForAccessToken(
                destroySession: true,
				forceLogin : true ,
                appBar: AppBar(
                  title: Text('Demo Login Page'),
                )
         ) .then((accessToken) => print(accessToken) )
           .catchError((error){
                print(error.errorDescription);
	});

Get Your Profile #

	LinkedInLogin.getProfile(
                destroySession: true,
                forceLogin: true,
                appBar: AppBar(
                  	title: Text('Demo Login Page'),
                )
         	) .then((profile) => print(profile.toJson().toString()) )
              .catchError((error){
                	print(error.errorDescription);
	});

Get Your Email #

	LinkedInLogin.getEmail(
                destroySession: true,
                forceLogin: true,
                appBar: AppBar(
                  	title: Text('Demo Login Page'),
                )
         	) .then((email) => print(email.toJson().toString()) )
              .catchError((error){
                	print(error.errorDescription);
	});

Additional Information #

Get The Full API Documentation from here

[1.0.0] - Added Linked Login

[1.0.1-dev.1] - Formatted the code

[1.0.1] - Added Example

[1.0.2] - Added Documentation

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_linkedin/linkedloginflutter.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final String redirectUrl = 'https://app.carde.de';
  final String clientId = '78el5r2y1dwp4j';
  final String clientSecret = 'RnyXiCNz3cahNx1g';

  @override
  void initState() {
    LinkedInLogin.initialize(context,
        clientId: clientId,
        clientSecret: clientSecret,
        redirectUri: redirectUrl);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Container(
        width: MediaQuery.of(context).size.width,
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          RaisedButton(
            onPressed: () {
              LinkedInLogin.loginForAccessToken(
                      destroySession: true,
                      appBar: AppBar(
                        title: Text('Demo Login Page'),
                      ))
                  .then((accessToken) => print(accessToken))
                  .catchError((error) {
                print(error.errorDescription);
              });
            },
            child: Text('Get AccessToken'),
          ),
          RaisedButton(
            onPressed: () {
              LinkedInLogin.getProfile(
                      destroySession: true,
                      forceLogin: true,
                      appBar: AppBar(
                        title: Text('Demo Login Page'),
                      ))
                  .then((profile) => print(profile.toJson().toString()))
                  .catchError((error) {
                print(error.errorDescription);
              });
            },
            child: Text('Get Profile'),
          ),
          RaisedButton(
            onPressed: () {
              LinkedInLogin.getEmail(destroySession: true)
                  .then((email) => print(email.toJson().toString()))
                  .catchError((error) {
                print(error.errorDescription);
              });
            },
            child: Text('Get Email'),
          ),
        ]),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_linkedin: ^1.0.2

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/config/api_routes.dart';
import 'package:flutter_linkedin/data_model/auth_error_response.dart';
import 'package:flutter_linkedin/data_model/auth_success_response.dart';
import 'package:flutter_linkedin/data_model/email_response.dart';
import 'package:flutter_linkedin/data_model/profile_error.dart';
import 'package:flutter_linkedin/data_model/profile_response.dart';
import 'package:flutter_linkedin/helpers/access_token_helper.dart';
import 'package:flutter_linkedin/helpers/authorization_helper.dart';
import 'package:flutter_linkedin/helpers/email_helper.dart';
import 'package:flutter_linkedin/helpers/profile_helper.dart';
import 'package:flutter_linkedin/linkedloginflutter.dart';
import 'package:flutter_linkedin/widgets/linked_in_web_view.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform Linux

Because:

  • package:flutter_linkedin/linkedloginflutter.dart that imports:
  • package:flutter_linkedin/widgets/linked_in_web_view.dart that imports:
  • package:flutter_webview_plugin/flutter_webview_plugin.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Web

Because:

  • package:flutter_linkedin/linkedloginflutter.dart that imports:
  • package:flutter_linkedin/widgets/linked_in_web_view.dart that imports:
  • package:flutter_webview_plugin/flutter_webview_plugin.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform Windows

Because:

  • package:flutter_linkedin/linkedloginflutter.dart that imports:
  • package:flutter_linkedin/widgets/linked_in_web_view.dart that imports:
  • package:flutter_webview_plugin/flutter_webview_plugin.dart that declares support for platforms: Android, iOS

Package does not support Flutter platform macOS

Because:

  • package:flutter_linkedin/linkedloginflutter.dart that imports:
  • package:flutter_linkedin/widgets/linked_in_web_view.dart that imports:
  • package:flutter_webview_plugin/flutter_webview_plugin.dart that declares support for platforms: Android, iOS

Package not compatible with SDK dart

Because:

  • flutter_linkedin that is a package requiring null.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://smarttersstudio.com was unreachable.

Documentation URL doesn't exist. (-10 points)

At the time of the analysis the documentation field http://api.smarttersstudio.com/flutter_linkedin/ was unreachable.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
flutter_webview_plugin ^0.3.11 0.3.11
http ^0.12.1 0.12.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8 1.2.2
path 1.7.0
pedantic 1.9.0 1.9.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test