login method

Future<void> login(
  1. BuildContext context, {
  2. required List<VKScope> permissions,
})

permissions - token permission list it is recommended to always use VKScope.offline

Implementation

Future<void> login(BuildContext context, {required List<VKScope> permissions}) async {
  if (_isInit == false) throw "You should call unit() before";

  if (_token != null && _profile != null) return;

  /// after closing this page, the value of the token will be written in the [GlobalVars.token]
  await Navigator.push(
      context,
      MaterialPageRoute(
          builder: (context) => LoginPage(
                appId: _appId,
                permissions: permissions,
              )));
  await _setToken(GlobalVars.token);
}