Flutter Tutorial - Shared Preferences - Store & Load Data For Data Persistence

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

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

  • @HeyFlutter
    @HeyFlutter  Год назад

    This might help you :)
    👉 12 Week Flutter Training from Newbie to Expert: heyflutter.com
    Source Code: github.com/JohannesMilke/shared_preferences_simple_example

  • @gnrslashsp6501
    @gnrslashsp6501 3 года назад +3

    Thanks for all the tips in your videos. You make videos differently than everyone else. You are objective, not so fast, nor so slow and I am really enjoying learning from your knowledge. Very good!

    • @Neerajkumar-xl9kx
      @Neerajkumar-xl9kx 2 года назад

      @@HeyFlutter i want to ask one question, if you are awake, reply me soon
      is it possible to write function in firebase in python language?

  • @prashantbhardwaj7627
    @prashantbhardwaj7627 Год назад +1

    Johannes the saviour!! thanks man for all the content you share.

    • @HeyFlutter
      @HeyFlutter  Год назад +1

      Glad to hear that, You are most welcome Prashant Bhardwaj! 😊

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

    Thanks for this great tutorial, but i got this error Field '_preferences' should be initialized because its type 'SharedPreferences' doesn't allow null.
    - 'SharedPreferences' is from 'package:shared_preferences/shared_preferences.dart'
    how to fix this?

    • @francescoinerba
      @francescoinerba Год назад

      use "late"!
      static late SharedPreferences _preferences;

  • @MdSiam-kw5ox
    @MdSiam-kw5ox 2 года назад

    I used shared preferences for storing theme data. This increased my app starting time.

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

    Excellent .. Thank you so so so Much.... such a beautiful Explanation... You are an excellent teacher...
    If I had got you as my teacher in my engineering , I would have become Google Pichai... Now I am working as Gate keeper....

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

    Thank you so much man. I found your channel yesterday and I subbed. I hope you keep up the flutter tutorials.

  • @stanezeaku7187
    @stanezeaku7187 3 года назад +3

    You are that great teacher, I have being looking for, just watched two of your videos in RUclips and I fell so much in love with how you simplify different approaches in step and use a more clear examples. I am definitely buying your lifetime access course!!!

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

    i'm afraid of shared preferences & always try to avoid it's use but after watching this video i love shared preferences :)

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

    Thank you for this video. I've been searching this content throughout the whole internet but couldn't understand it before. Now I know what to do, thanks to you :)

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

    That's totally what I look for to handle "favorite list" locally. Thank you again "Johannes the super hero! :))))))

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

      Glad it helped, Gökhan Ersoy! 🙂

  • @gheorghepascu4726
    @gheorghepascu4726 Год назад

    Your videos are the best! I've never seen anything like that before!

    • @HeyFlutter
      @HeyFlutter  Год назад

      Thanks, @gheorghepascu4726! 🙂

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

    Thank you very much sir for giving best to us. Learning lot from you 🎉✌️✌️

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

    keep going man, useful videos)

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

    Oh man you are so good instructor, thank you alot

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

    thank you :) this is the tutorial i've been looking for

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

    You ARE A LIFE SAVER

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

    The video I've been waiting for😍

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

    thanks for the tutorials, really learnt a lot from you and very inspiring!!

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

    Great work! Very explanatory tutorial...! Thanks!

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

    On dirait que vous lisez dans mes pensées pour faire vos vidéos ...Love You

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

      @@HeyFlutter Merci beaucoup encore une fois monsieur

  • @Jan-ym1cg
    @Jan-ym1cg 2 года назад

    Thank you so much! You helped me a lot with your videos :)

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

    Merci pour tes vidéos

  • @Oudipus
    @Oudipus 5 месяцев назад

    Thank youu soooooooooo muchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
    I love you man, I LOVE YOUUUUUUUU

    • @HeyFlutter
      @HeyFlutter  5 месяцев назад

      Thanks, for your support, @adamsekerka3428! 🙂

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

    Hey help me. Now this package got Null Safety. Please Make another video on this or help me solve the problem.
    static SharedPreferences _preferences;
    above line shows me error due to null safety. how to solve?

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

    Thank you so much for the explanation :)

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

    great content Johannes...and well explained

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

      Thank you, Thafseer Ahamed! 🙂

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

    Thank you very much :)

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

    Awesome video. Thanks. Subscribed

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

    Great Job.
    Thank you Very much

  • @nguyenvanbaokhuongk15hcm96
    @nguyenvanbaokhuongk15hcm96 Год назад

    have you tried to print out on console all the value you've stored when you reload (hot reload or turn off and turn on the app) ?
    I applied it in my project, I stored 3 value (example id, username, and imageURL) when I print out all three on console, it returns three but all three have the same value (not separately like id = 1, username = ABC, imageURL = XYZ but id = 1, username = 1, imageURL = 1).

    • @HeyFlutter
      @HeyFlutter  Год назад

      Thank You Nguyen Van Bao Khuong (K15 HCM)! Follow this link: stackoverflow.com/questions/51215064/flutter-access-stored-sharedpreference-value-from-other-pages
      I hope you will get your answer 🙂

  • @DuNguyen-hz7sl
    @DuNguyen-hz7sl 3 года назад

    thank you bae!

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

    Johannes, I use shared_prefs on web apps but do you know what can I do to persist data between one and another debug sessions? Because when I stop debug or close the browser, I loose shared info saved and the program starts clear again, so I can't test if it is working or not until I deploy it. Is there a way do do it?

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

    Great videos always thanks

  • @bekzodturgunoff
    @bekzodturgunoff 10 месяцев назад

    thanks this is informative!!

    • @HeyFlutter
      @HeyFlutter  10 месяцев назад

      You are welcome, @bekzodturgunoff!

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

    Best videos as usual 🙂🙏❤

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

    Hello, is it the thing with the null safety and all the update on Flutter 2 ?

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

    how do use the sharedpref... to make the user see the first page of the app only once please

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

    Question
    Is it possible for me to access a shared preference from another flutter app?
    For example, I have an app (App 1) with a shared preference that is storing a user 'email' and i would like to get that email from another flutter app (App 2)

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

      @@HeyFlutter Which means I can access it even from another app in the same device?

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

    Thank you very much.

  • @alishthapa623
    @alishthapa623 Год назад

    if we use column instead of listView then if i reload after clicking on save then value is not stored , why is that?

    • @HeyFlutter
      @HeyFlutter  Год назад

      Hey, @alishthapa623 🙂 Widget type is nothing to do with shared pref data saving. Please try to follow the tutorial step by step

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

    How can i store list of custom class with shared prefrences instead of list of string ?

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

    Awesome!! Keep it up!! 👍

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

    Very helpful video

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

    Can the value stored in textfield be used on different screen ,and if edit on that screen ,will the changes reflect on both the screens .how can this be used to load initial value in textform field. bcos using initial value and controller gives error.

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

      Thank You Mirza Shahbaz Beg! Follow this link: stackoverflow.com/questions/56416126/how-to-get-value-from-textfield-and-display-in-textfromfield-another-screen
      I hope you will get your answer 🙂

  • @Abdul_Hadi_Maliky
    @Abdul_Hadi_Maliky Год назад

    Hello sir I am stuck in the same type issue. I am using an audio player that plays an audio. what I want to do is I want to store the position of the player and when the user re-navigate to the listening screen I want to resume the audio from where the user left. off course the position is of type Duration. need your help sir. if you have already worked on such issue please provide me the link. thanks in advance.

    • @HeyFlutter
      @HeyFlutter  Год назад

      Hey, @Abdul_Hadi_Maliky 🙂 you can make use of shared preference you can store the milliseconds value and reload the music from that stored millisecond value

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

    Hi, I like your videos a lot and as an absolute beginner in programming they are very helpful.
    I'm wondering if you could explain how to save a rerouting. What I mean is for example:
    On your homescreen you have a button leading to the page 'list of car manufacturers of the world'. But on the homescreen you can also select within a drop down list (or similar) a location, e.g. Europe, North America, Asia etc. and safe this resulting that the button on your homescreen leads you to a page with only these car manufacturers in that part of the world.
    Maybe you already explained something like this in a different video? If yes could you tell me which one. You have quite a lot 😁

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

    Can you show how to save themedata in sharedpreferences? I cant save my toggleTheme
    Thank you!

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

    Cool, could you record a lesson about in_app_purchase without RevenueCat

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

    Please make video about this Only one device login limit we need this sir tanx

  • @Hi-tk4he
    @Hi-tk4he 3 года назад

    Useful video. Can you make one to store checkboxlist array and pass value to next page.

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

    What is the Maximum size in. Mb we can save in shared preference ? Or how many key pairs value we can save at least. Thanks in advance. As always you are the best.

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

    so good

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

      @@HeyFlutter what do you think between package flutter_session and shared_preferences good better?

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

    Nice tutorial!
    I tried to create an app with the same concept of this tutorial, I only using string datatypes, and it gives me an error "type 'List' is not a subtype of type 'String?' in type cast". I hope you can help me out :)

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

    Great videos man. Do you have a preferred file structure for projects?

  • @user-gp1uj9ml5t
    @user-gp1uj9ml5t 3 года назад

    very good

  • @MrDude-td5tl
    @MrDude-td5tl 2 года назад

    Thanks for your Tutorial.
    Flutter_secure_storage and Shared_preferences and Flutter_Session are save data in local storage.
    but JWT Token save data in cookies.
    Which once is better and safe?
    do we need JWT token when we use Flutter_secure_storage or not?

    • @MrDude-td5tl
      @MrDude-td5tl 2 года назад

      @@HeyFlutter But in back_end we need jwt token to send token to shared preferences.
      is that correct?

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

    You're a talented man. but we are beginner, hope w=you will teach us from more scratch.

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

    Where is the information stored? Are any files created in memory?

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

      @@HeyFlutter Thank you so much for the great video and for this further explanation

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

    Super stuff. Just perfect. Sad we don't have an option for Int Lists!
    I see SystemChrome in the start of your programs... Could you share some link/knowledge about this class too? Thanks

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

      @@HeyFlutter thank you. The Flutter docs should have had more info about such an important class.
      But you've been a greater help. Will send you an email today. Thanks again!

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

    Great Video!! Like some others, too ;)
    I implemented the SharedPreferences to save my isDarkMode boolen. I also implememted the DarkMode functionality from your other video. But how can I combine this to things? So I just want to save the boolean of isDark and load it when the app opens. I placed my switch button to a separate page.

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

    Thanks u ! but I got still problem "The non-nullable variable '_preferences' must be initialized.
    Try adding an initializer expression."

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

      static SharedPreferences? _preferences; and change all to check if is null

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

    Thanks for the video! I got this message error: lib/main.dart:10:27: Error: The method 'init' isn't defined for the class 'UserPreferences'.

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

      The problem the method 'init' was Static. Result => Future init() async {...

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

    Can you do the same with boolean ?

  • @NurulIslam-dw8yp
    @NurulIslam-dw8yp 3 года назад

    This does not work in release mode

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

    Hey, can you please do a tutorial for Flutter and Firebase Realtime Database.

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

    Love your videos! One thing has me stumped.
    It's all very well converting a simple list of strings, but how do you convert a list of objects that have their own sub-properties (strings, dates, double's etc...)
    If you could provide some guidance on this you'll be saving me from a powerful headache :(

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

      @@HeyFlutter thanks so much! You're a superstar

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

    As dart 2.9 supports null-safety, we can write birthday??0 which means if birthday is null return 0.

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

    How to create api with dart?

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

    as I can see you are so active here and a good trainer . I need to learn 2 things . I don't know you have to teach me privately. I will honor your time how long you will spend with me. Can you help me pls ?

  • @Tt-wm1ze
    @Tt-wm1ze 3 года назад

    Great tutorial! what the best way to contact you? I am new to flutter but I have been able to build and login application with flutter and mysql but was wonder how should I go about to save to same user id the user got when registering when wanting to att more user details to register id . could this be done with a shared preference or token the gets saved to mysql. I am really stock and really like learn what steps to tackle the problem.

    • @Tt-wm1ze
      @Tt-wm1ze 3 года назад

      @@HeyFlutter Thanks you so much trying to solve the problem with connecting shared preferences to a MySQL database will get back to you!

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

    please can you make this method with provider

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

      Thanks for the idea, Ahmed Nasser! 🙂 I have added it to my list of ideas for future videos!

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

    Hello Johannes, i'm having an issue on how to download pdf file from firebase firestore, can you please create tutorial on how to download pdf file from firebase firestore
    Thanks.

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

      @@HeyFlutter thanks, that video based on uploading, how can i download the uploaded file from firebase?

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

      @@HeyFlutter thanks.

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

    please make video or youtube video flutter or other network video player in which we decrease the video quality like youtube. Thanks

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

    cool

  • @raymondkombo3979
    @raymondkombo3979 Год назад

    this video 2 years later is a whole lotta crap to be honest, though thank you for teaching the basics

    • @HeyFlutter
      @HeyFlutter  Год назад

      You are welcome, @raymondkombo3979 😊

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

    M sending you screenshot on your messenger plz check and reply if you understand what u want to do...

  • @Dima-qz4su
    @Dima-qz4su 3 года назад

    creepy as voice :DD but thanks man, u actually provided me with exactly what i was searching for

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

    why
    static SharedPreferences _preferences; is giving error??

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

      @@HeyFlutter ill try some other way… thanx anyways

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

      Hello ! did u get solutions?