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

[bug]: stacked generate - doesn't uses changes in stacked.json? #1064

Open
MacMeissner opened this issue Dec 4, 2023 · 2 comments
Open

[bug]: stacked generate - doesn't uses changes in stacked.json? #1064

MacMeissner opened this issue Dec 4, 2023 · 2 comments
Labels
Feedback Requested Waiting for new information from the OP

Comments

@MacMeissner
Copy link

Describe the bug

I created a new Project with 'stacked create app _my_app'.

After that there is a stacked.json in the root folder. I changed the "locator_name": "sl" and
used 'stacked generate'.

Script is running and after that...nothing changed. The name of locator is 'locator'. Am i missing something?

-second try-
renaming the locator in app.locator.dart to 'sl'.
==> final sl = StackedLocator.instance;
Application runs. Everything ok.
But after running 'stacked generate' in terminal app.locator.dart recreated with the default name 'locator'
==> final locator = StackedLocator.instance;

To reproduce

  1. create an app: stacked create app _my_app
  2. cd app_my_app
  3. open .
  4. searching for stacked.json in root
  5. renaming "locator_name": "locator" to "locator_name": "sl"
  6. saving file
  7. goto terminal
  8. run 'stacked generate'
  9. locator name is still the default name

Expected behavior

Expectation is to have a new generated app.locator.dart file containing this line of code.

final sl = StackedLocator.instance;

Screenshots

No response

Additional Context

No response

@ferrarafer ferrarafer added reproduce issues in the process of trying to reproduce the issue p2 Second highest Priority and removed reproduce issues in the process of trying to reproduce the issue p2 Second highest Priority labels Jan 9, 2024
@ferrarafer
Copy link
Contributor

Hi @MacMeissner , how are you? Sorry for the late response, we were busy with some projects.

As you can see on the documentation, locator_name is used when creating a new Service using the create service command.

To change the name of the locator in the app you have to change locatorName property in StackedApp annotation. For example:

@StackedApp(
  routes: [
    MaterialRoute(page: HomeView),
    MaterialRoute(page: StartupView),
    // @stacked-route
  ],
  dependencies: [
    LazySingleton(classType: BottomSheetService),
    LazySingleton(classType: DialogService),
    LazySingleton(classType: NavigationService),
    // @stacked-service
  ],
  bottomsheets: [
    StackedBottomsheet(classType: NoticeSheet),
    // @stacked-bottom-sheet
  ],
  dialogs: [
    StackedDialog(classType: InfoAlertDialog),
    // @stacked-dialog
  ],
  locatorName: 'sl',
)
class App {}

Can you try this please? Let me know if it works.

@ferrarafer ferrarafer added Feedback Requested Waiting for new information from the OP and removed reproduce issues in the process of trying to reproduce the issue labels Jan 10, 2024
@FilledStacks
Copy link
Contributor

Any update on this @MacMeissner we want to close this issue if it's been resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feedback Requested Waiting for new information from the OP
Projects
None yet
Development

No branches or pull requests

3 participants