I'm really sorry about my mispronunciation of "variable" and other English words. By the time I realized my error, it was too late to re-shoot. Apologies for butchering the English language. (Again.) I'll try to do better next time.
@valternegreiros45113 жыл бұрын
No worries
@sainoba13 жыл бұрын
It actually gives it a little bit of a charm
@AlvarLagerlof3 жыл бұрын
Don't worry. I'm not native either. It's totally clear what you were meaning to say and the content is great!
@filiphracek3 жыл бұрын
Thanks all! I'm feeling a lot better about it. This community is so wonderful.
@emekachukumah70163 жыл бұрын
No need to apologize. Great video!
@josiahsaunders49363 жыл бұрын
This is a beautiful thing. I can't imagine how hard it was to create this feature. Thank you flutter/dart devs :)
@stainly75293 жыл бұрын
Yeah but it’s copied from other languages. Swift is the first to have it.
@robbet24773 жыл бұрын
@@stainly7529 Bro the important thing is the improvement in the language, Swift has copied things from Java and C ++ 😜, but for that reason it is not necessary a Fanboy saying it everywhere, languages are to solve problems, and developers use them as tools, create problems = bad programmer 🙄😒
@lx2222x3 жыл бұрын
It isn't hard at all, it is actually easier
@yiweima44123 жыл бұрын
@@lx2222x Yup, its not about difficulty, its about innovation. No matter how hard something is its still some what achievable, but if lack of innovation you cant even imagine it.
@pranjal86able3 жыл бұрын
@@stainly7529 I have seen this idea been discussed before swift existed. Swift made it mainstream. Chris Lattner never claimed that swift/him invented this. Swift is awesome and so is dart imo.
@hatema3 жыл бұрын
Dart is a really good language and I hope it grows out of Flutter's shadow.
@promisenwanno59693 жыл бұрын
Yes, I think so too. It's one of those languages that was created with sense of reality. Just like javascript and php. Provides the needed and avoids unnecessary formalities.
@michasengotta22953 жыл бұрын
@@promisenwanno5969 except JavaScript is a mess and Dart isn't
@androov27973 жыл бұрын
Eminem Fan, you got my support
@albertoazinar12092 жыл бұрын
This guy is really good at explaining Flutter stuff. Amazing video
@AltagraciaOliveАй бұрын
you are by far the best person explaining binary options! Thank you for putting these videos together. I look forward every week to see your videos!
@amirgamil3 жыл бұрын
I learnt about Flutter and Dart shortly after I started learning Kotlin. Not having null safety seemed like such a loss. Now that it'll be in Dart soon, I'm super happy to see that it'll be in Dart soon. And sound safety as well. Thanks Filip and the Flutter and Dart teams for all your hard work!
@ilkercankaya37793 жыл бұрын
I was expecting this to arrive sooner or later. Things are very easy when it has null safety such as in kotlin.
@NextLevelCode3 жыл бұрын
Did you notice though that it has more in common with Swift than Kotlin? List at 2:47
3 жыл бұрын
I can't wait to be able to use this, I come from Kotlin and I totally miss this feature
@kishorekittu48003 жыл бұрын
Can anyone explain How this is different from the kotlin's null safety? What is this sound null safety and how is it different from the normal one?
@christiang.36163 жыл бұрын
Beautiful. This reminds of the time when I had to copy null-safety boilerplate code and paste through a number of dart files. Thank you Dart devs ❤❤
@IsaacLarbiOnline3 жыл бұрын
I sure will stay null safe, thanks for a down to earth presentation, you did a great job explaining.
@kherelable3 жыл бұрын
I love you guys. Thank you for revive the joy of coding.
@mohamedoumast603 жыл бұрын
Thank you Flutter for the great effort to solve this old problem, now I can program safely, thank you
@user-v2eqj8xiz4l3 жыл бұрын
Since I coded with Dart, when I come across JavaScript & PHP variables, I ask myself what is this? what I supposed to do!? I love how dart make me unsafety on another language.
@vutuananh7473 жыл бұрын
Totally same with Swift, but it's still awesome. Thanks Flutter team :D
@abigailchin90503 жыл бұрын
The devil works hard to introduce null errors but the dart development team works harder 😂🙏🏼
@msjahun3 жыл бұрын
😂🤣
@ymi_yugy31333 жыл бұрын
I like the new syntax but it would have been nice to introduce the concept in a more general form, i.e. tagged union, or better yet also introduce tuples to give dart the full power of algebraic data types.
@algeriennesaffaires70173 жыл бұрын
I wasn't able to understand what null safety mean but now i understand thank you
@promisenwanno59693 жыл бұрын
I love Dart! One of those languages that was created with sense of reality. Straight to the point without unnecessary formalities- just like javascript and php.
@atabayilker3 жыл бұрын
Null exceptions always happen and hurt a programmer's feelings :D nice feature. Loving the Dart and Flutter more and more everyday. Hopefully google never stops developing on this particular technology.
@meetpanchal88093 жыл бұрын
The introduction music is so soothing 😅
@bikashkalita8712Ай бұрын
now i'm feeling better. u made it so easy.. thank you :)
@HenriqueMDerosa3 жыл бұрын
Awesome video! Great! Thanks for that! 🌟
@pepepriest59732 жыл бұрын
This really changed a lot from the last time i coded in dart
@samuellamanyeaglago69193 жыл бұрын
my 2 hour search is over. At long last, a question mark saved the day!
@sodiboo3 жыл бұрын
nice disclaimer at the start, i figure it's meant to be easy to remove with youtube's video editor on pre-uploaded videos? for anyone watching in the future when null safety is stable, remove about 15 seconds from any timestamps that seem to link to the wrong part of the video and see if it makes any more sense, since that disclaimer is about 15 seconds long
@DionisiusWahyuAdiSaputra3 жыл бұрын
Thank you for the hard work! Keep it up :)
@donathmm38813 жыл бұрын
Awesome!!!!!!! Thank you google!!! Flutter and dart are the best! Syntax is exactly like in swift I love it 😍
@notaspectator3 жыл бұрын
If im not mistaken, this was one of the neat features of ruby and using question mark , also available in typescript
@hosseinazem5203 жыл бұрын
Nice thank u. i have a question. we should use ! when we guess maybe the value is null?
@valternegreiros45113 жыл бұрын
Better than Kotlin, thank you so much
@aadarsh88693 жыл бұрын
Kotlin has also null saftety
@SEGVeenstra3 жыл бұрын
@@aadarsh8869 think he is aiming for the sound null safety. Which indeed makes it better then Kotlin imo
@thedude616363 жыл бұрын
@@SEGVeenstra what is null sound exactly I'm not sure I understand it
@SEGVeenstra3 жыл бұрын
@@thedude61636 there is a difference in null-safety and sound null-safety. Kotlin is null-safe, which means you can declare fields to be non-nullable but technically things can still be null in some ways. We have it in a project that serializes Json. We can define properties as non-nullable, but it could still turn out to become null. With sound null-safety you are guaranteed it will never be null, allowing the compiler to be optimized. Swift for example is also sound null-safe.
@sindrenm3 жыл бұрын
@@SEGVeenstra So how exactly does Dart make sure that fields from a back-end API are null safe? Will it not allow non-null types from a network call, for instance?
@SibirianWolf1987 Жыл бұрын
Very well explained!
@MaximoPower20243 жыл бұрын
Really interesting
@tdrkDev3 жыл бұрын
Thank you for such informative and easy to understand guide 😁
@carloselilopeztellez78023 жыл бұрын
Love the feature, awesome vid!
@heaven7pro Жыл бұрын
Great explanation! Thanks a lot
@amdsy09973 жыл бұрын
Thanks, very useful. And the best part that it looks almost identical to Swift.
@wandermonk12663 жыл бұрын
Thanks for your explanation. What is your native language anyway?
@tananga15233 жыл бұрын
Super video. Please create more news videos and tutorials.
@mohammadelkhatib3 жыл бұрын
Awesome Great feature from flutter team 👌
@MatthewPolack2 жыл бұрын
Thanks for this...there is a few of us taking a Beginner Flutter course with Angela Yu...and in one of the lesson she has us coding like this: void main() { greet(greeting: 'Hey', namePerson: 'Cindy'); } void greet({String namePerson, String greeting}){ print("$greeting $namePerson"); } But this now throws a Null error in the latest Dart.......us beginners in the comments note that we can fix this either by putting a '?' at the end of the String...or by placing the word 'required' before 'String'...but what should we do in this case ideally? Thanks for any clues if you have a moment!
@abdullahalmaruf55133 жыл бұрын
Beautifuly explained. Thanks a lot 👍
@chordfunc30723 жыл бұрын
This is going to be great! Can't wait for it to be out of beta!
@ninjaasmoke3 жыл бұрын
Yes. YES. *YES* THANK YOU😭😭😭😭♥️♥️♥️♥️
@moazelsawaf20002 жыл бұрын
Thanks a lot, great and simple video ❤
@VarunArora143 жыл бұрын
Hi. I have a question. If I fetch data as Json object from 'jsonplaceholder.typicode.com/albums' and show its contents after jsonDecode in listView builder with child: Text(drinks[index]['title']) where drinks is jsonDecode(response.body) then it gives error " An expression whose value can be 'null' must be null-checked before it can be dereferenced. Try checking that the value isn't 'null' before dereferencing it" and after putting the question mark after word 'drinks' removes the error. I tried searching about it but did find only declaration with question marks and null safety with '?.' , '??', '!' . Is child: Text(drinks?[index]['title']) correct and what does this question mark after drinks imply in layman language as it gets a little confusing.
@goldmenberd13503 жыл бұрын
Good feature = good practices = good code = good software = good results. Thx to devs
@hasansalim18682 жыл бұрын
Thanks. Nice video as usual.
@shivambulsara85093 жыл бұрын
This is great! Thank you!
@SisirKumarPathy3 жыл бұрын
Will enabling null-safety, break existing code? Like moving from "@required" to "required" is already doing.
@sodiboo3 жыл бұрын
Yes, the type system is changing and thus code will clearly code will break, preexisting code may return "String" and return null sometimes, now that's not possible, instead you need "String?" - albeit an easy fix, but so is actually most code broken by this, even if a bit tedious to do everywhere (oh hey have you heard of that migration tool that makes it less tedious?)
@maksym.koshovyi3 жыл бұрын
C# has the same feature since C# 8, why there's no check here? 2:25 Complier analyzes code flow and warns if some value can be null where is shouldn't be
@Magnetron6923 жыл бұрын
Thank you, much appreciated!
@NBSgamesOfficial2 жыл бұрын
Knowing how annying NullPointerExceptions can be in Java and how NullSafety like this can be from Kotlin and Swift. I am going to love Dart even more than now... I hope it does grow out of java lol. Like. Go on. We have a Dart to javascript transcompiler. And I used it with a Cordova app a while back.
@mehmetedex3 жыл бұрын
this is what we needed thanks
@SergeMatveenko3 жыл бұрын
It worth to mention, that Rust does it in almost the same way. I was expecting to see Rust reference in the table presented in the video.
@Nephtys13 жыл бұрын
That's actually not correct, Rust does not have the concept of null, coming from RAII. It solves the underlying issue by using generic enums (Option and Result most of the times).
@SergeMatveenko3 жыл бұрын
@@Nephtys1 Result is different. Rust does have the concept of null exactly in the way Dart has introduced it. Dart extracts null as a separated type in the type tree. Which, in effect, is the same as having a separate value for this which is None in Rust. Some in Rust or any non-Option type is the same as the default non-nullable introduced in Dart. Option in Rust has exactly the same meaning as "Type?" has now in Dart. Rust forces you to unwrap Option in the same way Dart forces you to handle null case.
@SergeMatveenko3 жыл бұрын
By the way, the same behavior is in effect in modern Python using strict type annotations and a static check like mypy. Using Optional[Type] will result in the static check error unless you are handling None case successfully.
@jarnopunt3 жыл бұрын
I really like this null safety feature, but I do not really understand why it is not possible to throw a warning (like @ 3:38 ) when you declare a function that only allows non-null variables but you send a possible null variable, like @ 4:18. This kind of feels like an 'incomplete null safety' Or am I wrong?
@abdullahhejazi69073 жыл бұрын
That's actually a great one. Just one question, will I be able to cast Nullable values to non-Nullable and vice versa ?
@h8moss7663 жыл бұрын
Not flutter nor affiliated with flutter, but 3:49 will probably work with variable casting too
@abdullahhejazi69073 жыл бұрын
@@h8moss766 oh yes, I think you're right
@PamudasanTutorial3 жыл бұрын
Hi, how do I add interstitial ads and admob banner ads to flutter ? Help me !
@arjundureja3 жыл бұрын
Similar to optionals in Swift. Nice
@TheMr82k3 жыл бұрын
What about the existing codebase? Is null safety going to be optional? If not then will there be a official tool to help in migrating?
@ciriousjoker3 жыл бұрын
It's optional. Idk about a migration tool but I'd expect there will be
@filiphracek3 жыл бұрын
Yes, there is a migration tool. I'm showing it off in this part of a different video: kzbin.info/www/bejne/mGe8n6eHiLCGbck. And yes, it is also optional. You have to actively opt into the feature.
@gameplaydosabao3 жыл бұрын
You guys are missing the optional cats tag (as?). This is really important when you’re writing a safe null source code.
@hardiannicko2 жыл бұрын
It is now possible. For example: Color? color = aVariable as Color?
@agung_laksana3 жыл бұрын
Finally, I can use it like Swift and Kotlin. When is it ready to production then?
@YolunSonu13 жыл бұрын
Oh god, I developed an android app 2 years ago with older Dart version and I started to upgrade it in these days without knowing the language is almost completely changed.
@francisgeorge76393 жыл бұрын
I don't get it. I find null is a way to catch my mistakes which I think I would be more liable to miss and end up with subtle bugs, and the crashing thing, does it really happen? The ?. and ?? operators were already as much as I think we needed. Even with Delphi, 25 years ago, null exceptions were caught in the event loop and simply showed an error box, no crashing at all. And Flutter/Dart is arguably the new Delphi. C++, Java etc apps might bug out, but that was because they didn't have Anders Hejlsberg to show them the way. Can someone give me a persuasive example of how this improves our lives?
@Canaris3 жыл бұрын
All the "old" null-value-errors occured at runtime. Which sucks. Now all null-value-errors occure at compile(!) time. If you program/script/tool compiles, it is guaranteed to not have any null-value-errors. That's why it's so awesome.
@francisgeorge76393 жыл бұрын
@@Canaris ahh, I get it. That is awsome.
@vinceramces3 жыл бұрын
How about the late keyword? Wasn't that part of dart's null safety feature?
@TheMr82k3 жыл бұрын
Yeah I was waiting for that one too most of time in Flutter apps we have null due to initState, this feature also does the job but will have to add null checks everywhere
@user-v2eqj8xiz4l3 жыл бұрын
Yes, it is. new feature is ?, ! and late. you can read more here dart.dev/null-safety
@sodiboo3 жыл бұрын
Indeed. The "late" keyword works very similarly to what non-sound null safety did, it simply means "This variable should always have a value by the time it is accessed, but i can't prove that by putting it in an initializer". An example would be a "Coffee" class that has "heat()", "cool()" and "serve()" methods, in the user of this coffee library they would always either heat or cool their coffee before serving it, otherwise that's invalid - heat() and cool() each assign the "temperature" field, and before they're called that field won't have a value. Dart's type system can't know you're meant to use that method before serve(), so when accessing the temperature to decide whether to serve "ice cold", "cool", "chilly", "room temperature", "warm", "hot" or "burning" coffee dart will tell you "Hey! that value can be null". To get around this you want a bang, but if that's the intended use, just put a bang everytime, you might wanna remove the explicit bang operator, so instead the "late" keyword at variable declaration would say "Hey i can't exactly prove this to you, but just trust me that when i access this i know it won't be null unless another developer did something wrong". When a variable has the "late" modifier, the same checks will be performed as when accessing null with a bang operator (or any variable access in non-nullsafe dart), mainly because the dart type system has trust issues from several null reference errors, and when the late variable does *not* have a value (i.e. null) it throws a LateInitializationError. There is one more benefit than just removing the bang, the "late" modifier doesn't actually change the type of the variable according to what values are allowed in it, so with a nullable type and then using a bang everywhere you can assign null, with a late modifier and non-nullable type you *cannot* assign null, once it *has* a value it will *always* have a value, even if it changes if the field/variable isn't final TL;DR it's like a nullable type you can't assign null, and the dart type system will null-check it for you and throw a LateInitializationError if it's uninitialized, and it signifies it will always be assigned before usage when the type system doesn't know that.
@kazukihiromoshito29353 жыл бұрын
I really am looking for some "or alternative" code that looks up to the "alternative" value if the preceding value is null or undefined, like... Color color = favoriteColor | Colors.blue; where "|" is some "or alternative" operator, such that if favoriteColor is null, it opts to the Colors.blue value. I tried it on Dart but didn't work... or are there some syntax to that? I'm rooting for a response, and if there is no operator like that yet, I hope something comes up.
@king40533 жыл бұрын
Color color = favoriteColor ?? Colors.blue
@pranjal86able3 жыл бұрын
"Stay null-safe out there", hahaha that's hilarious
@akshattamrakar90713 жыл бұрын
Thanks
@dnnnvx3 жыл бұрын
Awesome language, and awesome community
@arslankhan88253 жыл бұрын
@Filip is java has null safety?? I don't think @2:25
@FlutterInsights3 жыл бұрын
I either check null value nd validate them or use null aware operator nd set the default value
@reactiveland31113 жыл бұрын
common, ? mark. Wasn't it possible to use something like annotations instead?
@zakariasahri3 жыл бұрын
Can anyone explain to me what's the difference between dart null safety and kotlin null safety??
@mrogalski2 жыл бұрын
Okay I'm just starting to learn flutter and all that dart thingy but this feels like obsessive fear of nulls. You've explained that you're not allowing "developers" ( read as pseudo developers ) to use null pointers/values just because they can hurt themselves? That's like the worst case I can think of and forcing usage of such mechanisms is wrong on it's base. Imagine having huge system that relies on some object value, let's even imagine it will be amount deducted from your client bank account and just by forcing reassignments of that value you can recieve some random number at the end of processing because "it cannot be null". This way the application instead of throwing an exception will just say "ok, we deducted this random number from you client bank account". The real question is.. when we start treating developers as adults? Or when did we become so unaware that we need that much of assistance?
@mihaelablenche3 жыл бұрын
Great content!
@navczydev3 жыл бұрын
I am writing Kotlin day to day job, and it's also has sound null safety, when we have nullable variable we need to treat it properly otherwise compiler shows an error
@gokulakrishnan19773 жыл бұрын
Finally I can say goodbye for Red screen 🤩.
@Randomdude-i8x2 жыл бұрын
Instead of a null crash I now have empty screens which are harder to debug. Not sure if this is an advancement.
@nromancarcamo3 жыл бұрын
is this already done in Mid Feb, 2021?
@softcoda3 жыл бұрын
lol...it's OK. Very good presentation
@sabuj7453 жыл бұрын
Great Video
@heinzbert33423 жыл бұрын
take this feature in the compiler instead of tons of lines with questions marks
@qingbaohe70823 жыл бұрын
Can I get authorization to share to Chinese media? Such as WeChat.
@user-v2eqj8xiz4l3 жыл бұрын
This feature change everything, now all project make many errors? how deal with old project since they has many variable without question mark?
@EdgarFroes3 жыл бұрын
Elbow grease the heck out of that project, I say.
@redbrogdon3 жыл бұрын
The Dart team created a tool to help you migrate your code to use null safety: dart.dev/null-safety/migration-guide. There''s still some elbow grease required, but you're not on your own!
@CollinLi3 жыл бұрын
You missed an opportunity to make that last list thingsYouDontLikeAboutNullSafety? null
@blablablabla293823 жыл бұрын
sound great !! Wp
@arslankhan88253 жыл бұрын
void main() { int? da=null; print('hello ${da+1 }'); } I don't understand the exact reason of null safety , above code need to apply null check. then whats the benefit ??
@yiweima44123 жыл бұрын
Its for handling code that is from other packages or deeply nested in the tree, when you are unsure whether the variable is null because the logic behind may not be obvious like the deliberate example above, I shall say the example is even foolish.
@arslankhan88253 жыл бұрын
@@yiweima4412 you mean in this case int? da=null; "da" variable should not be the nullable. am I right?
@arslankhan88253 жыл бұрын
@@yiweima4412 could you explain it as an example
@yiweima44123 жыл бұрын
@@arslankhan8825 First of all, you need to move away from the traditional thinking of assigning a variable null just by making it a convenient "placeholder" to accept some values later. Before declaring the variable, you need to think does the variable make sense if been given a null value (hence giving a meaningful variable name is very important here), and must have a strong enough reason to do so. For example, you are creating a social media app, and have a user model with a string field called "displayName". Your app allows user to login as a guest, hence "displayName" make sense to be nullable as guest would not have any displayName, then it makes sense to declare it as sound null safe: String? displayName; When accessing the variable, it thus make sense also to check whether the variable is null before using it: print(displayName);
@arslankhan88253 жыл бұрын
@@yiweima4412 Thank you so much for a great detail, I will read it let you know if have any question. again Thank you so much
@mileusna3 жыл бұрын
What about initial values? int count; Is count still null or 0? Will this be allowed without question mark?
@redbrogdon3 жыл бұрын
Non-nullable fields are required to be initialized with values, though you can mark them "late" in the rare case that you aren't able to initialize them right away (but will before they're read).
@filiphracek3 жыл бұрын
Also, thanks to flow analysis, you can do something like this: int count; if (blah) { count = 10; } else { count = 0; } // ... Here, `count` is _non-nullable_, even though it starts uninitialized. Dart proves the count is not read before it is assigned, and allows this. Note that this only works for local variables (e.g. in functions). For class fields, Dart can't prove things like that, so you need something like `late`.
@mileusna3 жыл бұрын
@@filiphracek Thanks. Since I do go-lang on server side I was secretly hoping it would be similar like in the Go where by default int is 0, string is "" etc. 😁 It will be interesting migration. 😁
@GeorgeNoiseless2 жыл бұрын
Indeed. Stay null-safe, everyone!
@kapowrobot79423 жыл бұрын
Also the larger general programming question is.... Is null a feature or bug?
@yiweima44123 жыл бұрын
I shall say both, its a bug if you dont use this feature correctly.
@iitgsahil Жыл бұрын
Please fix the subtitles 🙏 They're lagging
@ludanaltegani56542 жыл бұрын
Thank you
@erlangparasu63393 жыл бұрын
why kotlin is not 'sound null safety' ?
@filiphracek3 жыл бұрын
Here's an analysis of Kotlin and other languages: github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/roadmap.md#kotlin
@asadsalehumar10113 жыл бұрын
I really don't understand the meaning of 'sound'. What does it mean? As a non native speaker, I only understand 'sound' as in 'sound wave' which we hear.
@filiphracek3 жыл бұрын
The word sound has a bunch of unrelated meanings. One of them is "dependable" or "reliable". In the context of null safety or type systems, it means the system is not approximating. It can _prove_ things are one way or another.
@davidchopin65833 жыл бұрын
Any guard let/if let?
@pkgo11229 ай бұрын
Awesome! 🚀
@kevinliu60023 жыл бұрын
Stress syllable on the first syllable for va-ri-a-ble, sir! VA-riable. Not va-RIA-ble.
@edwardduong69143 жыл бұрын
This is not null safety, this is just a way to declare a maybe-null-variable.