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

Document (current) best practices for platform-specific code (PSC) #1750

Closed
kevmoo opened this issue Jul 10, 2019 · 4 comments
Closed

Document (current) best practices for platform-specific code (PSC) #1750

kevmoo opened this issue Jul 10, 2019 · 4 comments
Assignees
Labels
d.enhancement Improves docs with specific ask e2-days Can complete in < 5 days of normal, not dedicated, work e3-weeks Complete in < 4 weeks of normal, not dedicated, work p2-medium Necessary but not urgent concern. Resolve when possible.

Comments

@kevmoo
Copy link
Member

kevmoo commented Jul 10, 2019

We have basic support for PSC, but it's not well documented and there are potentially big holes that a user could fall through.

  • Document the recommended approach here
  • Link to working examples (pkg:http, etc)
  • Explain pitfalls (defining types, exports, etc)
  • Hint at future direction?
@kevmoo kevmoo added the d.enhancement Improves docs with specific ask label Jul 10, 2019
@kevmoo kevmoo self-assigned this Jul 10, 2019
@kwalrath kwalrath added docs e3-weeks Complete in < 4 weeks of normal, not dedicated, work p2-medium Necessary but not urgent concern. Resolve when possible. e2-days Can complete in < 5 days of normal, not dedicated, work labels Jul 10, 2019
@kevmoo kevmoo changed the title Document (current) best practices for configuration-specific code (CSC) Document (current) best practices for platform-specific code (PSC) Jul 11, 2019
@mit-mit mit-mit assigned mit-mit and unassigned kevmoo Aug 7, 2019
@banalg
Copy link

banalg commented Aug 17, 2019

If I can just add my two cents on this topic. I'm currently developing some IoT stuff on a RaspberryPi with Dart. I usually test on my laptop where it isn't possible to use the physicals pins of the Raspberry Pi, so I developed a mocked library to simulate button press and on/off a led. But I currently need to manually switch the package import between the real and the mocked GPIO library.
I checked the http library and the control seems be done by checking the presence of these dart components : dart.library.html or dart.library.io.
But in my case, as both (Raspberry Pi and my laptop) use the dart.io library, which kind of control could I use ? Isit possible to check the operating system, or another things ?

@natebosch
Copy link
Member

Is it possible to check the operating system, or another things ?

No, only the presence or absence of the dart: libraries. Imports based on arbitrary other information are not compatible with our approach for modular builds.

@escamoteur
Copy link

@mit-mit Another application would be see here flutter/flutter#30845 if someone want's to have different pages for iOS/Android but don't want to carry the code of the not used platform with it.

@mit-mit
Copy link
Member

mit-mit commented Nov 13, 2019

Closing as a dupe of #1569, which has an active PR. If anything is missing there, please comment on the PR

@mit-mit mit-mit closed this as completed Nov 13, 2019
@atsansone atsansone removed the docs label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d.enhancement Improves docs with specific ask e2-days Can complete in < 5 days of normal, not dedicated, work e3-weeks Complete in < 4 weeks of normal, not dedicated, work p2-medium Necessary but not urgent concern. Resolve when possible.
Projects
None yet
Development

No branches or pull requests

7 participants