Closed merdandurmus closed 2 years ago
Hi, can you please copy and paste your pubspec.yaml file?
Yes, of course, this is the pubspec.yaml file: name: mobile_client description: A new Flutter project. publish_to: 'none' version: 1.0.0+1
environment: sdk: ">=2.7.0 <3.0.0"
dependencies: intl: ^0.17.0 flutter: sdk: flutter http: ^0.13.3 flutter_web_auth: ^0.3.0 fitbitter: ^1.0.0-dev.5 cupertino_icons: ^1.0.2 time_machine: ^0.9.16 sqflite: path:
dev_dependencies: flutter_test: sdk: flutter dart_code_metrics: ^3.1.0 dartdoc: ^0.42.0 mockito: ^5.0.7 build_runner: ^2.0.2 flutter: uses-material-design: true
Sorry but I can't reproduce the error. The snippet you sent me is working on my device without any problems. If somebody from the community will have the same problem I will reopen the issue.
Exact same issue i am facing
This error can be generated by the fact that somehow you are not awating for the access token to be stored within GetIt such that when Fitbitter tries to use it using FitbitConnector.isTokenValid (see "FitbitConnector.isTokenValid (package:fitbitter/src/fitbitConnector.dart:73:40) #7 FitbitDataManager._checkAccessToken (package:fitbitter/src/managers/fitbit<…>") it generates the error.
Currently working on that
@merdandurmus and/or @nayanS95, I just released fitbitter 1.1.1. It should fix the problem, can you check that? Thanks
The Fitbitter throws an exception on the following code:
The following error is thrown: `Failed assertion: line 315 pos 7: 'instanceFactory != null': Object/factory with type SharedPreferences is not registered inside GetIt. (Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance; Did you forget to register it?)
0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
2 _GetItImplementation._findFactoryByNameAndType (package:get_it/get_it_impl.dart:315:7)
3 _GetItImplementation.get (package:get_it/get_it_impl.dart:336:29)
4 _GetItImplementation.call (package:get_it/get_it_impl.dart:373:12)
5 new FitbitAuthAPIURL.isTokenValid (package:fitbitter/src/urls/fitbitAuthAPIURL.dart:112:34)
6 FitbitConnector.isTokenValid (package:fitbitter/src/fitbitConnector.dart:73:40)
7 FitbitDataManager._checkAccessToken (package:fitbitter/src/managers/fitbit<…>`
Since the code resembles the example on GitHub as much as possible this shouldn't be the case.