This might help you :) 👉 12 Week Flutter Training from Newbie to Expert: heyflutter.com Source Code: github.com/JohannesMilke/key_global_example UniqueKey Tutorial: kzbin.info/www/bejne/jZnRc5Jrrs-sjbM ValueKey Tutorial: kzbin.info/www/bejne/Y3fCZqx-osSNqdE Null Safety Tutorial: kzbin.info/www/bejne/h5C6naKDg7CCobc Migrate App To Null Safety Tutorial: kzbin.info/www/bejne/fX3RgqOefc5keLs Native Splash Screen Tutorial: kzbin.info/www/bejne/bn6oaXawpshghcU Create Flutter Project For App Stores Tutorial: kzbin.info/www/bejne/apeUcoJjm5Kdj7M QR Code Scanner App Tutorial: kzbin.info/www/bejne/kGSViKaLnrSYndU Barcode Scanner App Tutorial: kzbin.info/www/bejne/e6vdqWObfqdnja8 Onboarding UI Screen Tutorial: kzbin.info/www/bejne/eYLPcmWmYpKie8k Date Picker & Time Picker Tutorial: kzbin.info/www/bejne/l5DJeKavrN5_b5I Face ID - Local Auth Tutorial: kzbin.info/www/bejne/jXrOlZablrSIpNU Fingerprint - Local Auth Tutorial: kzbin.info/www/bejne/p4XYh6iofNuXmK8 App Internationalization Tutorial: kzbin.info/www/bejne/kKiXfKKlp7urnck
@nerdbenana2 жыл бұрын
This is way better than the official video. Thanks for the explanation!
@yasmeenabushaar20192 жыл бұрын
You're the best ........ thanks a lot Milke for this tutorial
@HeyFlutter2 жыл бұрын
You’re most welcome, Yasmeen Abu shaar! 🙂
@gersonchadijunior7499 Жыл бұрын
Man you saved my life ! Thank you ! You have a new follower
@HeyFlutter Жыл бұрын
Glad I could be of help, Thank you gerson chadi! 😊
@cavidanbagiri78372 жыл бұрын
Prosda Perfecto Teacher. You Are Krasavcik
@Sankkku2 жыл бұрын
Best teacher!!
@heisenberg58733 жыл бұрын
Best video about key
@flavio.a2 жыл бұрын
Thank you for this tutorial. It helped me a lot!
@JobinJacobKavalam3 жыл бұрын
Thank you. I found out how a parent widget can call methods in it's child's state.
@danielekpenyong59302 жыл бұрын
love your videos man keep it up
@HeyFlutter2 жыл бұрын
Thank you, Daniel Ekpenyong! 🙂
@arnaudduquenoy20613 жыл бұрын
So clear when you explain :) You should have been my math teacher when i was young :))
@arnaudduquenoy20613 жыл бұрын
I returned today on the Global Key series. These kind of specialized tutos are very usefull compared to so many basic Dart tutos that you can find on the internet. A lot of people are trying to find advanced tutos on Dart but the majority of them are so Basic compared to these kind of tuto
@HeyFlutter2 жыл бұрын
Awesome, thanks a lot, Arnaud! 🙂 Yeah, I try my best so that people don't say the same about Flutter in the future 😉
@abdulrehman-ws9wl3 жыл бұрын
Great Explanation...Thank you
@abdulrehman-ws9wl3 жыл бұрын
@@HeyFlutter Have you create video on other type of keys in flutter like : unique key, Value key etc.?
@mohammadal-sadiqh.38713 жыл бұрын
Great explanation... Thank you
@yousour51123 жыл бұрын
clear and perfect , thank you :)
@TrikNgonlen3 жыл бұрын
that's great, @Johannes Milke ...
@farhanahmad-bv1mx2 жыл бұрын
Awesome👏👍
@CodeWhizbang3 жыл бұрын
Thanks.
@NurulIslam-dw8yp3 жыл бұрын
Thanks
@meetamin73432 жыл бұрын
Thanks🙏🙏
@zerocel3 жыл бұрын
thank you !!! finally useful!!!
@kingbheem6403 жыл бұрын
Can you pls explain how to create multiple enddrawer in a single same page with different content
@usmanshoaib20992 жыл бұрын
I am receiving GlobalKey current state null ?? I have tried for variable and function both but getting null value.
@enafor993 жыл бұрын
thank you so much awesom tutorial:)
@piattidjoka89463 жыл бұрын
Thanks you sir
@meetrajpopat23483 жыл бұрын
one question brother my local app notification(not the firebase but native) is not working when app is terminated what to do(i already watched your old videos)? can you please make video on that? and also make video on native ad which uses the latest package from google ad, old one is deprecated and i lost where the part to write native code inside manifest file there is some errors regarding package and also note that i also used fluuter_native_ads package but due to new firebase firestore package i got error while building i will be very thankful if you help me out, btw love your content
@fluffycatstream61962 жыл бұрын
Hi, How to access GlobalKey to another flutter page / file? another people asked this 6 months ago and you give a very outdated way. please tell me properly I really need this thank you.
@fluffycatstream61962 жыл бұрын
@@HeyFlutter this does not work sir, this is a different topic
@kasandrop3 жыл бұрын
thanks for it I prefer to read the subtitles though.
@spinoff20113 жыл бұрын
And what happen with the explanation of the plain keys (not the global)? :s
@eNONO-ot4zh3 жыл бұрын
in my projet i have this error: Looking up a deactivated widget's ancestor is unsafe. I try to folloz your course but i have a error like: "'dynamic' doesn't conform to the bound 'State' of the type parameter 'T'. Try using a type that is or is a subclass of 'State'." and "The name '_SalerListViewAnnounceWidgetState' isn't a type so it can't be used as a type argument. Try correcting the name to an existing type, or defining a type named '_SalerListViewAnnounceWidgetState'."
@HeyFlutter2 жыл бұрын
Thank you, e.NONO! 🙂 Make sure wherever you are using navigator.pop() must have atleast one screen availabe on stack
@congtoannguyen19402 жыл бұрын
How do I dispose a TextFormField correctly with this global Form and can I (or should I ) dispose the Global Form Key too if so then how
@HeyFlutter2 жыл бұрын
Thank You Cong Toan Nguyen! Follow this link: stackoverflow.com/questions/68095494/why-did-if-statement-dispose-textformfield-in-flutter I hope you will get your answer 🙂
@piyushbhatnagar4735 Жыл бұрын
Which key we have to use with Stateless Widget
@HeyFlutter Жыл бұрын
Thank You @piyushbhatnagar4735! Follow this link: stackoverflow.com/questions/50080860/what-are-keys-in-the-stateless-widgets-class I hope you will get your answer 🙂
@vaibhavdangayachvd3 жыл бұрын
Why not use provider?
@theghost66063 жыл бұрын
I dont understand why we use keys. In this example we used the key to access the methods and variables. But this is also possible with Classname.variable isnt it ?
@theghost66063 жыл бұрын
@@HeyFlutter Thank you. Now i understand. Great Video!
@HeyFlutter2 жыл бұрын
Thanks, The Ghost! 🙂 The first example was only a very simple demonstration to showcase how Global Keys work, however, you are right this should not be used in your apps because you could also pass the counter variable directly down from the parent to the child widget without using GlobalKeys. The second example at 4:17 is a real example that makes more sense to use since the widget is from the Flutter SDK and we have no direct control over it however with the help of Global Keys we can access this external widget - its state and also its logic. Global Keys should be mainly used to access logic & state of EXTERNAL Source Codes such as packages & the Flutter SDK, as demonstrated at 4:17. If you write your own widgets prefer to use StatelessWidgets & write your logic with a State Management, then you don't need to care about Global Keys anymore. Check also my tutorials out about State Management here: 1. Riverpod Basics Providers Tutorial: kzbin.info/www/bejne/bnmWk6qurdGUars 2. Riverpod Basics Notifiers Tutorial: kzbin.info/www/bejne/rHWQemR3h66ApM0 3. Riverpod Basics Modifiers Tutorial: kzbin.info/www/bejne/bZmVc6WqgJ11psk 4. Riverpod & Calculator UI Tutorial: kzbin.info/www/bejne/bJrWiGVsmZ6Hn6c 5. Provider Tutorial: kzbin.info/www/bejne/mZ3XdKOOjptjic0 6. Provider & Firebase Tutorial: kzbin.info/www/bejne/e4eVdayogLSkqLs
@njomaboujaib49953 жыл бұрын
Great and clear content as always
@njomaboujaib49953 жыл бұрын
@@HeyFlutter it worked :D thanks for the explanation and quick answer :) you are the best
@HeyFlutter2 жыл бұрын
Thanks, Njm! 🙂 Sure good question, first of all you need to check if you can access the state of your GlobalKey by checking if keyCounter.currentState != null. Only if the currentState exists then you could access the state & logic of your StatefulWidget with the help of your GlobalKey. Check out the example below where we display the counter within the AppBar Title: import 'package:flutter/material.dart'; class BasicKeyPage extends StatefulWidget { @override _BasicKeyPageState createState() => _BasicKeyPageState(); } class _BasicKeyPageState extends State { final keyCounter = GlobalKey(); @override Widget build(BuildContext context) { final counter = keyCounter.currentState == null ? '0' : keyCounter.currentState!.counter; return Scaffold( appBar: AppBar( title: Text('My Counter: $counter'), centerTitle: true, ), body: Center( child: CounterWidget(key: keyCounter), ), floatingActionButton: FloatingActionButton( child: Icon(Icons.add), onPressed: () => setState(() => keyCounter.currentState!.increment()), ), ); } } class CounterWidget extends StatefulWidget { const CounterWidget({Key? key}) : super(key: key); @override _CounterWidgetState createState() => _CounterWidgetState(); } class _CounterWidgetState extends State { int counter = 0; void increment() => setState(() => counter += 5); @override Widget build(BuildContext context) => Text( 'Counter: $counter', style: TextStyle(fontSize: 32), ); }
@immunemart4843 жыл бұрын
How to make the height of the cursor same with the height of text in UITextField?
@immunemart4843 жыл бұрын
@@HeyFlutter i know but i have many doubts, so i comment on ur latest video so that u give me attantion.
@HeyFlutter2 жыл бұрын
Thanks, Mart! 🙂 This seems to be unrelated to the concept of Global Keys. Learn more about TextFields here: kzbin.info/www/bejne/eWbLe3yBeLmlrM0
@robertmrobo89543 жыл бұрын
Hi Milke, How do I access the global key defined in a different dart file?
@fabioburkard3 жыл бұрын
@@HeyFlutter Excellent tutorial, Johannes! If you know any (recent) solution using GlobalKey, pls share... I don't know why, but some old codes don't work anymore, using GlobalKey's inside different files.
@HeyFlutter2 жыл бұрын
Thank you, Robert Mrobo! You could learn more about this problem here : stackoverflow.com/a/29182641
@Wick__op2 жыл бұрын
Nice
@HeyFlutter2 жыл бұрын
Thank you, blacky arinova! 🙂
@Tech1st3 жыл бұрын
Why r u using keys?
@HeyFlutter2 жыл бұрын
Thanks, Tech1st! 🙂 In this video, we were focused on Global Keys. With a Global Key, you can access the state of Stateful Widgets. Therefore a Global Key can be useful to access the state & logic of other widgets as demonstrated at 7:32 Especially the Flutter SDK uses this technique to implement some logic within their Stateful Widgets which you can then access over a GlobalKey. All in all, it is mainly used to access the logic of StatefulWidgets that were created for you within the Flutter SDK or within other Flutter packages.
@shubhamjaitapkar33592 жыл бұрын
if you make the class in different you won't be able to access the key!!