flutter_vk_login

A Flutter plugin for using native android VKSdk.

This project havealy influented by flutter_facebook_login.

Warning: This Flutter plugin working only on Android.

Getting Started

First things first, create standalone app on your VK app manage page. Save AppID (или ID приложения).

In your android res/values create strings.xml and fill with this examples

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="app_name">Flutter VK Login example</string>
    <integer name="com_vk_sdk_AppId">YOUR_VK_APP_ID</integer>
</resources>

Than, add vksdk dependency in android/app/build.gradle

dependencies{
    //...your other dependecies
    api 'com.vk:androidsdk:1.6.9' //or api, I am new to android dev.
}

Next, in android section off your flutter app create class Application

package com.example.name;

import io.flutter.app.FlutterApplication;
import com.vk.sdk.VKSdk;

public class Application extends FlutterApplication {
    @Override
    public void onCreate() {
        super.onCreate();
        VKSdk.initialize(this);
    }
}

And in your AndroidManifest.xml edit application section to this

<application
        android:name=".Application"
        ...
/>        

Dart usage

final VkLoginResult result =
        await vkSignIn.logIn(['email']);

    switch (result.status) {
      case VKLoginStatus.loggedIn:
        final VKAccessToken accessToken = result.token;
        _showMessage('''
         Logged in!
         
         Token: ${accessToken.token}
         User id: ${accessToken.userId}
         Expires: ${accessToken.expiresIn}
         Permissions: ${accessToken.scope}
         ''');
        break;
      case VKLoginStatus.cancelledByUser:
        _showMessage('Login cancelled by the user.');
        break;
      case VKLoginStatus.error:
        _showMessage('Something went wrong with the login process.\n'
            'Here\'s the error VK gave us: ${result.errorMessage}');
        break;
    }
  }

Libraries

flutter_vk_login
i18n

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]