Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: update deprecated and minor code refactors #710

Merged
merged 6 commits into from
Feb 27, 2023

Conversation

saileshbro
Copy link
Contributor

No description provided.

Copy link
Member

@validcube validcube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove const because CacheConfig isn’t a const constructor

Analyzing revanced-manager...

  error - The constructor being called isn't a const constructor - lib\services\crowdin_api.dart:14:59 - const_with_non_const
  error - The constructor being called isn't a const constructor - lib\services\github_api.dart:16:60 - const_with_non_const
  error - The constructor being called isn't a const constructor - lib\services\revanced_api.dart:19:60 - const_with_non_const

The constructor being called isn’t a const constructor. - https://dart.dev/tools/diagnostic-messages#const_with_non_const

@saileshbro
Copy link
Contributor Author

@evademaster please have a look now.

@validcube validcube self-requested a review February 25, 2023 07:12
@validcube
Copy link
Member

validcube commented Feb 25, 2023

@evademaster please have a look now.

Upon installing the application via flutter run, the application froze and threw an error.

Log

I/flutter ( 8437): Error while creating ManagerAPI
I/flutter ( 8437): Stack trace:
I/flutter ( 8437):  #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
I/flutter ( 8437): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
I/flutter ( 8437): #2      _GetItImplementation._findFactoryByNameAndType (package:get_it/get_it_impl.dart:372:7)
I/flutter ( 8437): #3      _GetItImplementation.get (package:get_it/get_it_impl.dart:393:29)
I/flutter ( 8437): #4      _GetItImplementation.call (package:get_it/get_it_impl.dart:430:12)
I/flutter ( 8437): #5      StackedLocator.call (package:stacked_core/src/code_generation/locator/stacked_locator.dart:85:17)
I/flutter ( 8437): #6      new ManagerAPI (package:revanced_manager/services/manager_api.dart:21:43)
I/flutter ( 8437): #7      setupLocator.<anonymous closure> (package:revanced_manager/app/app.locator.dart:35:39)
I/flutter ( 8437): #8      _ServiceFactory.getObject (package:get_it/get_it_impl.dart:160:41)
I/flutter ( 8437): #9      _GetItImplementation.get (package:get_it/get_it_impl.dart:409:34)
I/flutter ( 8437): #10     _GetItImplementation.call (package:get_it/get_it_impl.dart:430:12)
I/flutter ( 8437): #11     StackedLocator.call (package:stacked_core/src/code_generation/locator/stacked_locator.dart:85:17)
E/flutter ( 8437): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:get_it/get_it_impl.dart': Failed assertion: line 372 pos 7: 'instanceFactory != null': Object/factory with  type SharedPreferences is not registered inside GetIt.
E/flutter ( 8437): (Did you accidentally do GetIt sl=GetIt.instance(); instead of GetIt sl=GetIt.instance;
E/flutter ( 8437): Did you forget to register it?)
E/flutter ( 8437): #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter ( 8437): #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter ( 8437): #2      _GetItImplementation._findFactoryByNameAndType (package:get_it/get_it_impl.dart:372:7)
E/flutter ( 8437): #3      _GetItImplementation.get (package:get_it/get_it_impl.dart:393:29)
E/flutter ( 8437): #4      _GetItImplementation.call (package:get_it/get_it_impl.dart:430:12)
E/flutter ( 8437): #5      StackedLocator.call (package:stacked_core/src/code_generation/locator/stacked_locator.dart:85:17)
E/flutter ( 8437): #6      new ManagerAPI (package:revanced_manager/services/manager_api.dart:21:43)
E/flutter ( 8437): #7      setupLocator.<anonymous closure> (package:revanced_manager/app/app.locator.dart:35:39)
E/flutter ( 8437): #8      _ServiceFactory.getObject (package:get_it/get_it_impl.dart:160:41)
E/flutter ( 8437): #9      _GetItImplementation.get (package:get_it/get_it_impl.dart:409:34)
E/flutter ( 8437): #10     _GetItImplementation.call (package:get_it/get_it_impl.dart:430:12)
E/flutter ( 8437): #11     StackedLocator.call (package:stacked_core/src/code_generation/locator/stacked_locator.dart:85:17)
E/flutter ( 8437): #12     main (package:revanced_manager/main.dart:20:26)
E/flutter ( 8437): <asynchronous suspension>
E/flutter ( 8437):

Screenshot

flutter_16

Tested on flutter & dev branch.

Copy link
Member

@validcube validcube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saileshbro
Copy link
Contributor Author

saileshbro commented Feb 26, 2023

@evademaster you need to run the generation to generate the dependency injection for the SharedPreferences

flutter pub run build_runner build --delete-conflicting-outputs

@saileshbro saileshbro requested a review from validcube February 26, 2023 13:20
@validcube
Copy link
Member

@evademaster you need to run the generation to generate the dependency injection for the SharedPreferences

flutter pub run build_runner build --delete-conflicting-outputs

I.. I- yeah,

kill me, aaaaaaaaaaaaaaaa

I'm very, very sorry about that, yeah, I just reviewed your PR, LGTM 👍

@validcube validcube changed the base branch from flutter to dev February 27, 2023 11:26
@validcube validcube merged commit f1bdc19 into ReVanced:dev Feb 27, 2023
validcube pushed a commit to validcube/revanced-manager that referenced this pull request Feb 27, 2023
Improve code readability & additional refactoring

Commits:
chore: exclude generated from analyzer

refactor: add SharedPreferences to locator

refactor: access shared pref from locator, and code refactor

refactor: remove unwanted `await`

refactor: remove `const` from `CacheConfig`
validcube added a commit to validcube/revanced-manager that referenced this pull request Mar 3, 2023
validcube added a commit to validcube/revanced-manager that referenced this pull request Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants