Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swedesjs/vk_library
VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.
https://github.com/swedesjs/vk_library
api dart dartlang flutter library sdk vk vk-api vk-bot vk-sdk vkapi vkcom vkontakte vkontakte-api
Last synced: 3 months ago
JSON representation
VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.
- Host: GitHub
- URL: https://github.com/swedesjs/vk_library
- Owner: swedesjs
- License: bsd-3-clause
- Archived: true
- Created: 2021-10-19T20:12:39.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-21T10:33:49.000Z (over 2 years ago)
- Last Synced: 2024-09-22T08:03:20.376Z (3 months ago)
- Topics: api, dart, dartlang, flutter, library, sdk, vk, vk-api, vk-bot, vk-sdk, vkapi, vkcom, vkontakte, vkontakte-api
- Language: Dart
- Homepage:
- Size: 774 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# vk_library
[![Pub](https://img.shields.io/pub/v/vk_library?color=blue&style=flat-square)](https://pub.dev/packages/vk_library)VK SDK for Dart with support for all public VK api methods, Bots Longpoll, User Longpoll, etc.
## Get Started### Add Dependency
```yaml
dependencies:
vk_library: 1.0.4
```### Create a base class to work with
```dart
final vk = VK(options: VKOptions(token: 'token'));
```## Content
- [Examples](#examples)
- [Error processing](#error-processing)
- [Flaws and bugs](#flaws-and-bugs)## Examples
API request:
```dart
final request = await vk.api.users.get(userIds: ['durov']);print(request['response']);
```
> The same with the rest of the vk methods, syntax: `vk.api.`API request via native function:
```dart
final request = await vk.api.request('users.get', {'user_ids': ['durov']});print(request['response']);
```Receive longpoll updates:
```dart
final longpoll = GroupLongpoll(vk.api);longpoll.onUpdate().listen((event) {
print(event.toJson());
});longpoll.start();
```Receive user longpoll updates:
```dart
final longpoll = UserLongpoll(vk.api);longpoll.onUpdate().listen((event) {
print(event);
});longpoll.start();
```
## Error processingAPI request may result in an APIException:
```dart
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;
}
```## Flaws and bugs
Found a bug or a bug? - [issues tracker](https://github.com/swedesjs/vk_library/issues).