Skip to content

No Such Method Error #1

@rubberbird

Description

@rubberbird

HI, Getting this when I am trying out a basic auth.

*[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method '*' was called on null.
Receiver: null
Tried calling: (1000)
#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1 new DateTime.fromMillisecondsSinceEpoch (dart:core/runtime/libdate_patch.dart:39:36)
#2 _Strava&Object&Upload&Activities&Auth.isTokenExpired (package:strava_flutter/API/Oauth.dart:282:18)
#3 _Strava&Object&Upload&Activities&Auth.oauth (package:strava_flutter/API/Oauth.dart:154:19)

Looks like this was the issue, your comparing to a null string not null itself.

// Check if the token is not expired
    if (_token != "null") {
      globals.displayInfo(
          'token has been stored before! ${tokenStored.accessToken}  exp. ${tokenStored.expiresAt}');

      isExpired = isTokenExpired(tokenStored);
      globals.displayInfo('isExpired $isExpired');
    }

Also had some issues with the urlRefresh URL so I fixed that too.

   var urlRefresh =
        'https://www.strava.com/oauth/token?client_id=${clientID}&client_secret=${secret}&grant_type=refresh_token&refresh_token=${refreshToken}';

And also didn't have url_launcher package which it looks like is required. So I added that.

https://pub.dartlang.org/packages/url_launcher#-installing-tab-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions