Flutter Code Generation - What You Need To Know

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

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

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

    Great video. Im not a huge fan of code generation because I lose control over the code but my coworkers loves it. Thank you for simple but helpful video

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

    Great video! I've been wanting to get into code generation in flutter, especially with the Freezed package. This was a great intro! Great structure and length!

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

      Thanks Daniel. Very happy you found it helpful!

  • @devef
    @devef 4 года назад +9

    Also there is an extension in vs code, for generating “data class”. I used with equatable, and that’s it!!!

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

      Yes it's great! Using it for a future video!

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

      Me too. I don't have much time to generate like this. Extension is the best. 😁

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

      @@sankoko3115 I only used with hive for typeAdapters classes. Hivedb is insane!

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

      Me also use vs code extension, for generating “data class” and I generate just what I need. Freezed is great but he hide many unused code lines in the background and most begginers use it only for copywith 🤦‍♂️

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

      @@RobertBrunhage where is the video

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

    Always great !! Thanks a lot

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

    Thanks a lot, so i don't have to use the Equatable packages for immutable classes?

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

    Hey. I have a question about freezed (or json serializable)
    {
    "data": {
    this is a generic object and I cant parse with code generation
    },
    "errorCode": "string",
    "errorMessage": "string",
    "exceptionMessage": "string",
    "isSuccess": true,
    }
    can you give an advice how to do it cleanly?

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

      What do you mean with generic object? If it is another object you create that one, and use it as a type in this class!

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

      @@RobertBrunhage Thank you for your reply. I want something like that
      @freezed (or @JsonSerializable)
      BaseResponse{
      T data;
      String errorCode;
      ...
      ....
      }
      T data represents other jsons. I want something to make calls like that -> Future userResponse

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

      @@OtarBediashvili have you found any references now?

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

    Is that you liveoverflow?

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

    Hey sir. Great vid! It's like a fireship style please take it as a compliment cause hey its effective. Gone are the boring days of code teaching 😁

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

      So happy to hear this. Gotten a lot of inspiration from him as well as tips! Feels nice to hear a genuine compliment about it as I can sometimes feel like I am being a copycat.. haha 😅
      Working as hard as I can to make it more personal so thank you so much for the nice comment. It really made this week perfect!

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

      @@RobertBrunhage i guess for me imitating/learning from someone's approach and getting all the useful stuff you can get to improve one's self and benefiting on it is not bad a thing 😁

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

    My favorit is built_value, which is a combination of freezed and json parser. Why did you choose freezed?

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

      No particular reason what so ever. This was more to showcase how code generation can work, and some of the pros & cons!

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

    yeah great :) I use the Dart Data Class Plugin for Code Generation :)

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

    I didn't know freezed, thanks for the tip !

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

    Fireship 2?

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

      He is a huge inspiration to me, so I am taking this as a compliment! 😅

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

    wow ... thanks

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

    should use var keyword instead of typing out the whole class name for non-final declarations :)

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

    duplicate*

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

      Haha yeah noticed like 8h after upload 🤣

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

    flutter is boilerplate.

  • @danielhalmstrand2123
    @danielhalmstrand2123 4 года назад +6

    It’s to complicated ...

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

      Code generation is certainly not needed for everyone, but can be nice to know about!

  • @dr.strangelav4579
    @dr.strangelav4579 4 года назад +3

    Meh overkill, just install a plugin or something

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

      In many cases (medium - big projects) code generation is recommended by the Google see here: flutter.dev/docs/development/data-and-backend/json
      So overkill for sure in smaller projects. Other then that you can go without code gen, these are just recommendations!

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

    The most redundant video on flutter, phew

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

      Thanks for taking the time to write, was the topic redundant or the way it was presented?
      Love to get feedback so I can improve for future videos! :)

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

    I enjoy your videos but I find the squiggly lines very distracting.

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

      Thank you, with squiggly lines what do you mean, could you link a timestamp?

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

    You seem to have a Swedish accent.

  • @williambryant1672
    @williambryant1672 3 месяца назад

    over engineering

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

    I’ve never been able to get build_runner to work, always had a pub conflict when i tried