preface

Hello everyone, I’ve updated the theme article again, and of course I’m going to talk about some of the “strange things” in the development of Flutter. In this article, let’s talk about what you should know during development

Writing in the front

  • This article doesn’t deserve a picture
  • Common techniques for Flutter development

Listing of

  1. In the package managementpubspec.yamlTo add a dependency can be directlyprovider:, without the version number,flutter pub getIt will automatically update to the latest version of the current package, but we will add it whenever possibleversionWe know that Flutter is going very fast. We saw it two days agofl_chartThere is no scatter diagram, so what does it mean? The API that depends on the package will be updated at any time, which may cause the previous API to be invalid
  2. When writing parts, break them up as much as possible, wrapping a smaller unit around a layerContainerSo that we can modify it, like aHTMLIn theDivSame, add inner margin, outer margin
  3. Use state management where possible, including likeProviderAnd so on, it’s easy to maintain, it’s easy to sort out, kind of like oursVuex.Redux
  4. Avoiding more references to unnecessary third party packages, such as using some tool method plug-ins, can be great. The user might think the APP is big, but it’s notKing of Glory peace elite, we think there should be a few more G, but for general projects we will still consider the size of the package
  5. When using scroll parts, we can try adding themshrinkWrap = trueIt’s really useful, mainly because the rolling parts take up a reasonable allocation of space
  6. Quick generation of code snippets:stful stlessWhen you type this in the editor, a beautiful code snippet appears, which is also the shortcut key mentioned in the comments section, provided you install the extension of courseAwesome Flutter Snippets Flutter Widget SnippetsThese two can be directly searched in Vscode plug-in, and then download
  7. When you want to change the value of the parent widget, it is not recommended to change it directly in the child widget. The best way is to pass a method through the parent widget
  8. VSCode: Quickly add the specified widget wrapper to the Flutter widget: I know this exists, but I looked for it. When developing Flutter applications with VSCode, widgets that are built often need to be covered with another layer of widgets. Using the refactoring feature in VSCode, this can be done quickly. Once the widget is selected, right-click and select Refactor. Or use the shortcut shift + CTRL + R.

— Keep updating ing-

Write in the last

Since it is accumulating every day, this article will continue to be updated to see how many lists we can make together. Meanwhile, welcome to my GitHub warehouse of foreign samples. At present, there are some Demos that I am studying


End but thank you