vkdart 2.2.0 copy "vkdart: ^2.2.0" to clipboard
vkdart: ^2.2.0 copied to clipboard

Package helps simplify working with the VK API. Completely wraps VK methods, has event support and much more.

example/example.dart

import 'package:vkdart/vkdart.dart';

void main() async {
  // Group ID is indicated if Longpoll API is used
  // if the fetcher parameter is not specified, Longpoll will be used by default
  final vkdart = VkDart('accessToken', groupId: 123);

  // Use callback API
  // final webhook = await Webhook.createHttpServer(
  //  secretKey: 'mySecretKey',
  //  confirmation: 'confirmationCode',
  // );
  //
  // final vkdart = VkDart('accessToken', event: Event(), fetcher: webhook);

  // message_new, message_edit, message_reply
  vkdart.onMessage().where((event) => event.isUser).listen((event) {
    vkdart.messages.send({
      'peer_id': 1,
      'message': 'Hello world!',
      'random_id': 0,
    });
  });

  // ignore: avoid_print
  await vkdart.start().then((_) => print('Longpoll API run!'));

  // use API
  // await vkdart.users.get({'user_id': 'durov'}); // List<Map<String, dynamic>>
  // await vkdart.utils.getServerTime({}); // int
  //
  // request via native function
  // await vkdart.request('groups.getById', {'group_id': 1}); // List<Map<String, dynamic>>
}
6
likes
0
points
68
downloads

Publisher

unverified uploader

Weekly Downloads

Package helps simplify working with the VK API. Completely wraps VK methods, has event support and much more.

Repository (GitHub)
View/report issues

Topics

#vkontakte #vk #api #vk-api #http

License

unknown (license)

Dependencies

http

More

Packages that depend on vkdart