vk_login 1.0.1 copy "vk_login: ^1.0.1" to clipboard
vk_login: ^1.0.1 copied to clipboard

Service for authorization via VK. Authorization takes place via webview. You do not need to have a registered VK standalone application

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:vk_login/vk_login.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (_) => VkProvider(),
      child: MaterialApp(
        title: 'Material App',
        home: Scaffold(
          appBar: AppBar(
            title: Text('Material App Bar'),
          ),
          body: HomePage(),
        ),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  late VkProvider _vk;

  @override
  Widget build(BuildContext context) {
    _vk = Provider.of<VkProvider>(context);
    return FutureBuilder(
        future: _vk.init(),
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.waiting)
            return Center(
              child: Text('Loading...'),
            );
          return Column(
            children: [
              TextButton(
                  onPressed: () => _vk.login(context,
                      permissions: [VKScope.stats, VKScope.groups, VKScope.messages, VKScope.wall, VKScope.offline]),
                  child: Text('login')),
              TextButton(onPressed: () => _vk.logout(), child: Text('logout')),
              if (_vk.profile != null) Text('${_vk.profile!.firstName}'),
            ],
          );
        });
  }
}
1
likes
120
pub points
31%
popularity

Publisher

unverified uploader

Service for authorization via VK. Authorization takes place via webview. You do not need to have a registered VK standalone application

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, http, shared_preferences, webview_flutter

More

Packages that depend on vk_login