5 Flutter Clean Code Tips That You Need

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 35

  • @RajA-me9cl
    @RajA-me9cl 4 года назад +14

    Then go to dirtiest toilet...... Cracked me up 🤣🤣

    • @howididit917
      @howididit917 3 года назад +1

      🤣😂 Me too. I paused and was like whaaat? I like this guy 👍👊

    • @和平和平-c4i
      @和平和平-c4i 3 года назад

      messy is not the same as dirty.
      This semantical confusion unfortunately prevents his argument about the messy room to be valid.
      (I am one of those guys who prefer the messy room, as long as it is not dirty)
      (My girlfriend does not agree with me, though.)

  • @ukaszwolenczak5590
    @ukaszwolenczak5590 2 года назад +10

    3:05 is NOT cleaner, and smaller than 1:07, you just created a bad abstraction with an ugly switch under the hood, an error in that switch will cause errors everywhere. Each of the 1:07 widgets, have one goal, easy to understand, and easy to maintain.

    • @bennguyen1313
      @bennguyen1313 2 года назад

      Any pythonic-like recommendation on best-practices for flutter/dart that professionals use for large apps?
      1) setting up a project (folder structure, settings json file edits, packages or vscode extensions (ex. lint))
      2) style (function/variable name format, camel, etc)
      3) themes
      4) stateless vs stateful tips

    • @seangreen9590
      @seangreen9590 2 года назад

      I agree it's ugly code too much chaining there's no need for that switch just create 3 different buttons and that will work much faster and cleaner and easy to maintain

  • @TheIllerX
    @TheIllerX 2 года назад +3

    Good advice just two comments.
    First, you missed to comment you second point about named constructors.
    Second, making a custom class for your input can backfire quite often. You don't want tons of small custom classes only used once in your code.
    That will make the functions harder to use. Anyone using them has to find that small custom class in the code and create an object to use the function.
    This will make the function more confusing to understand and therefore it will be less used by everyone else.
    If the class/and object you require is something more natural and reusable it is another story.

    • @ramsay9912
      @ramsay9912 2 года назад +1

      upon yr second comment, i totally aggree with it, as i felt it today
      i would like to share my GitHub reop for the project that i tried to make it perfect. However, it turnned into a complicated class when a new variable is added

  • @eduardoblas2315
    @eduardoblas2315 4 года назад +3

    What are the advantages of creating that enum and switch vs passing the function directly as an argument?

    • @LearnFlutterCode
      @LearnFlutterCode  4 года назад

      it depends on your use case. you can try both and see which one seems understandable

  • @crazy-man
    @crazy-man 2 года назад +1

    I liked the first tip, it seems to me more understandable, but how to implement the actionFunction(Action action) function? I only get it
    void actionFunction(Action action) {
    if (action == Action.add) {
    print("add");
    }
    }

  • @fullbridgerecrifier
    @fullbridgerecrifier 2 года назад

    Bro you are amazing :)

  • @santiagomamani6111
    @santiagomamani6111 4 года назад +2

    Good tips buddy, thank you!

  • @MaximoPower2024
    @MaximoPower2024 3 года назад

    If notLoggedInUserGoToSettings, maybe would be time to go to settings?

  • @VJKoding
    @VJKoding 4 года назад +3

    thanks for tips❤️️

  • @nirnullz
    @nirnullz 4 года назад +1

    Any tips to cleanup bracket hell?

  • @mruduladdipalli5417
    @mruduladdipalli5417 3 года назад

    Tip 3 is excellent

  • @1995taunus
    @1995taunus 3 года назад

    Thank you!

  • @workflop4117
    @workflop4117 4 года назад

    Thanks man learned some tips today ;D

  • @imanuelpundoko6831
    @imanuelpundoko6831 2 года назад

    I'm just move from JS to Flutter (dart), and looking for best practices to code dart.
    Agreed to first tip, but the rest of tip is not very practical.

  • @George-or3uv
    @George-or3uv 3 года назад

    Thanks for this, it’s very nice to follow.

  • @MaximoPower2024
    @MaximoPower2024 3 года назад +4

    3:05 Seriously?

  • @michasengotta2295
    @michasengotta2295 2 года назад +1

    Your save/edit/delete buttons are a mess. At least use a state pattern, but then you would notice that this splitting this widget made no sense

  • @ryszardsinius4828
    @ryszardsinius4828 3 года назад +1

    4:55 Naming lists of strings as singulars is also confusing

  • @seangreen9590
    @seangreen9590 2 года назад

    I subscribed but I unsubscribed because there is no need for talking trash it's a bad habit even your content is great but you won't get subscribers this way

  • @codefactory_official
    @codefactory_official 3 года назад

    some really nice tips! thanks!