Skip to content

LateInitializationError on client field #67

@muhammadyusuf-kurbonov

Description

@muhammadyusuf-kurbonov

Describe the bug
Remove late from client field. late field must be set even before read.

To Reproduce
Steps to reproduce the behavior:

feathers.init(baseUrl: baseUrl);
await feathers.reAuthenticate(); 
// ERROR!
  Future<Map<String, dynamic>> authenticate(
      {String strategy = "local",
      required String? userName,
      required String? password,
      String userNameFieldName = "email"}) async {
    if (this.client == 'rest') { // <- Error here. Tried to read before `client` was assigned
      return await standaloneRest!.authenticate(
          strategy: strategy,
          userName: userName,
          userNameFieldName: userNameFieldName,
          password: password);
    } else if (this.client == 'socketio') {
      return await standaloneSocketio!.authenticate(
          strategy: strategy,
          userName: userName,
          userNameFieldName: userNameFieldName,
          password: password);
    }
    ...

Expected behavior
Authenticate with rest and scktio doesn't need client to be set

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions