Pattern Matching in Dart 3 is Powerful!

Поділитися
Вставка
  • Опубліковано 29 січ 2025

КОМЕНТАРІ • 48

  • @artofnessa
    @artofnessa Рік тому +4

    WOOOOO!! pattern matching for the winn

  • @sadhlife
    @sadhlife Рік тому +5

    good to hear. it's a nice language feature for dart/flutter

  • @wizzl8513
    @wizzl8513 Рік тому +5

    We need more of this, great content!

    • @RobertBrunhage
      @RobertBrunhage  Рік тому

      Thanks, appreciate it! Any recommendations of what you would like to see?

    • @wizzl8513
      @wizzl8513 Рік тому

      @@RobertBrunhage Tips and use cases for new/existing language features. It saves a lot of time not having to read the documentation

  • @ahmdaeyz
    @ahmdaeyz Рік тому +1

    I like how you casually explained type promotion at 1:42

  • @FlutterMapp
    @FlutterMapp 4 місяці тому

    First, is the background made in blender? If yes, thats pretty damn cool, second, we need more content from you :)

  • @draakisback
    @draakisback Рік тому +1

    I'm glad that they finally added pattern matching to dart. I've been using it everywhere since it came through in dart 3.0. probably my favorite version of pattern matching is the elixir/Erlang module level pattern matching where are you can specify multiple functions with the same name in a module. So for example if I have a function that has optional arguments, I can create a function head that takes zero parameters and I create one for the optional parameters. The runtime will pattern match on the function head that is being invoked based on the amount of parameters that are being passed in. You can take this even further too, where you explicitly match on a value or on a type etc. It's unfortunate that we don't have this in dart but the dart version of pattern matching is still extremely powerful.
    My favorite use case in dart specifically is probably the first one you showed, where you can bind to a new variable if the sub case matches, it is basically rust's if let binding. It's kind of a shame that the enhanced enums are all constant, if they were more like union types, we could do a ton of different monads with pattern matching. For now you can do a similar thing with inheritance but it's not as powerful.

    • @_underscore
      @_underscore Рік тому

      Also in C++ "Function Overloading".

  • @truemmer
    @truemmer Рік тому +12

    I really like the new features for Dart 3.0, but I fear that readability will suffer in many projects 😅

  • @mtux
    @mtux Рік тому +1

    Thanks a lot, great video

  • @rumble1925
    @rumble1925 Рік тому +1

    Nice. This is something I miss in every language since trying one that has it

  • @poncewilmer
    @poncewilmer 11 місяців тому

    THANKS

  • @sujalabhani980
    @sujalabhani980 Рік тому

    finally a creator that makes something new and good.🙂

  • @firelight22
    @firelight22 Рік тому

    I didn't know about the fact you could add 2 variables into the switch statement :O

  • @rsajdok
    @rsajdok Рік тому +1

    Good explanation 🙂

  • @noelgomile3675
    @noelgomile3675 Рік тому

    This is going to be awesome with Flutter for making it easier to model logic for dynamically picking which widget to show

  • @toxaq
    @toxaq 9 місяців тому

    I wish you were still making videos!

  • @ArjunSinghh
    @ArjunSinghh Місяць тому

    Gr8 this is dart shorts helps to impoverished dart

  • @yorjansandoval9381
    @yorjansandoval9381 3 місяці тому

    se puede usar el inspector de widgets en neovim? yo no he podido usar neovim para flutter por esa razon.

  • @tayabfarooq7544
    @tayabfarooq7544 Рік тому

    Hello Sir! One thing that is flying in my mind for over two years is how did you become such a great programmer? Your answer means a lot to me!

    • @sexyeur
      @sexyeur Рік тому

      You'll have to "shake" back later.

  • @jackwarner1018
    @jackwarner1018 Рік тому

    I am interested in taking your course, but there is no information when it was last updated. Can you tell me what version of Flutter and Riverpod you use in the course?

  • @subsoho
    @subsoho Рік тому

    Thank you for ur video !. You have a nice IntelliSense system in ur editor . Which editor do you have and which intelligences system ? thank you.

  • @trainofthought5733
    @trainofthought5733 Рік тому

    bloc + pattern matching. makes life easier

  • @鄭小白-n4p
    @鄭小白-n4p 7 місяців тому

    hi, can you teach how to setup vim with flutter env?

  • @sirk3v
    @sirk3v Рік тому +2

    which editor is this?

    • @RobertBrunhage
      @RobertBrunhage  Рік тому +2

      NeoVim :) The best editor that has ever existed

  • @antongrekov7710
    @antongrekov7710 11 місяців тому

    rip legend

  • @rebarius
    @rebarius Рік тому

    I‘m just here for the „3“ ❤

  • @vikasdwivedi7769
    @vikasdwivedi7769 11 місяців тому

    Hey Robert still you think Flutter had good future, bcz there are very less project exist for flutter.
    Your suggestion.

  • @mikopiko
    @mikopiko Рік тому +1

    You must be from Sweden, I can hear it!

  • @olamilekanadeleke6806
    @olamilekanadeleke6806 Рік тому +2

    What IDE is that...
    And why is everyone hating on vs code, did I miss something 😅

    • @TechBuddy_
      @TechBuddy_ Рік тому +2

      It's neovim and we hate vs code cuz
      1. It's a Microsoft product
      2. Consumes a lot of memory
      3. Super slow

    • @RobertBrunhage
      @RobertBrunhage  Рік тому

      I actually stopped using vscode more than 2 years ago now. Just used VSCode for the videos because it would feel more comfortable for the viewer. Then I stopped caring :D
      No but it's NeoVim and it's the best and all others suck

    • @sirk3v
      @sirk3v Рік тому +1

      @@RobertBrunhage is that autocomplete from copilot or is it just inbuilt?

    • @RobertBrunhage
      @RobertBrunhage  Рік тому

      @@sirk3v The one where I have normal autocomplete from options are inbuilt LSP (same as other editors)
      The ghost text that I tab out is copilot

  • @TechBuddy_
    @TechBuddy_ Рік тому +1

    I would do _ => ... Instead of (_,_) => ... But great video as always

    • @RobertBrunhage
      @RobertBrunhage  Рік тому +1

      Fair!
      Didn't think about it when doing it in the video haha

  • @robschannel1156
    @robschannel1156 6 місяців тому

    this shit is by far the most confusing thing I've encountered in Dart so far.

  • @BonBaisers
    @BonBaisers Рік тому

    Readability is absolutly awful, specialy the first example. I would instant deny the "if" line in my code reviews.

  • @mazharsalam3144
    @mazharsalam3144 17 днів тому

    hi.. Thanks just tested and working
    for (String key in monthMapKeys) {

    if (eachType case final eachType?) {
    for (var e in eachType.keys.toList()) {
    if (!salesKeys.contains(e)) {
    salesKeys.add(e);
    }
    }
    }