vk_library 1.0.4 copy "vk_library: ^1.0.4" to clipboard
vk_library: ^1.0.4 copied to clipboard

VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.

vk_library #

Pub

VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.

Get Started #

Add Dependency #

dependencies:
  vk_library: 1.0.4
copied to clipboard

Create a base class to work with #

final vk = VK(options: VKOptions(token: 'token'));
copied to clipboard

Content #

Examples #

API request:

final request = await vk.api.users.get(userIds: ['durov']);

print(request['response']);
copied to clipboard

The same with the rest of the vk methods, syntax: vk.api.<method_name>

API request via native function:

final request = await vk.api.request('users.get', {'user_ids': ['durov']});

print(request['response']);
copied to clipboard

Receive longpoll updates:

final longpoll = GroupLongpoll(vk.api);

longpoll.onUpdate().listen((event) {
  print(event.toJson());
});

longpoll.start();
copied to clipboard

Receive user longpoll updates:

final longpoll = UserLongpoll(vk.api);

longpoll.onUpdate().listen((event) {
  print(event);
});

longpoll.start();
copied to clipboard

Error processing #

API request may result in an APIException:

try {
  await vk.api.groups.getById();
} on APIException catch (e) {
  print('Message: ${e.message}');
  print('Code: ${e.code}');
  print(e.requestParams.map((e) => e.toJson()).toList());
    
  rethrow;
}
copied to clipboard

Flaws and bugs #

Found a bug or a bug? - issues tracker.

3
likes
140
points
44
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.22 - 2025.04.06

VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

dio, json_annotation

More

Packages that depend on vk_library