Type-Safe Preferences With Proto DataStore (without Protobuf Files!) - Full Guide

  Рет қаралды 30,629

Philipp Lackner

Philipp Lackner

Күн бұрын

Пікірлер: 54
@DARKcarlos1
@DARKcarlos1 2 жыл бұрын
Nice explanation… and I loved the part of the PersistentList, even when it wasn’t the scope of the tutorial, you nailed it with that explanation. Hope you can make a tutorial migrating from shared preferences to proto datastore. Thanks phillip
@AlexMendezNewbrick
@AlexMendezNewbrick 2 жыл бұрын
In common situations where you just need to save a few app settings, Data Store implemented this way is Ok. The only "thing" with this implementation is that it's killing the performance benefits of protocol buffers. The JSON conversion is slow, kotlin-serialization library is faster than Gson, but, it's still slow, if I'm not mistaken it uses reflection which is expensive. In the case you need to access many registries in short periods of time (perhaps transferring data to/from server) using the serialization library on top of protocol buffers would be a mistake. In other words, protocol Buffers is a faster alternative to JSON so using JSON objects in a protocol buffer would be a performance problem.
@memezilla5639
@memezilla5639 2 жыл бұрын
can you please make a specific video about sockets plz
@CoderzF1
@CoderzF1 2 жыл бұрын
Awesome. I was able to follow along, except I added a few Strings to mine as well. Username, User Email, and Language
@CoderzF1
@CoderzF1 2 жыл бұрын
I didnt try to do anything with a list yet though
@andromadusnaruto1544
@andromadusnaruto1544 2 жыл бұрын
Thanks for the tutorial. Great explanation and practical implementation. I'm about to start Android soon but I've been using Kotlin for the server-side using Ktor. It's been great...
@Kuloczekk
@Kuloczekk 2 жыл бұрын
Hmm.. I also have error: kotlinx.serialization.SerializationException: Class 'SmallPersistentVector' is not registered for polymorphic serialization in the scope of 'PersistentList'. Mark the base class as 'sealed' or register the serializer explicitly. With the data classes: @Serializable data class ShoppingCart( val productsList: PersistentList = persistentListOf() ) @Serializable data class ShoppingCartItem( val id: String = "", val size: String = "" )
@peterka4711
@peterka4711 2 жыл бұрын
Struggling with this as well. Seems to be an issue with PersistentList and kotlin immutable collections or even kapt apparently. Have you managed to fix the error?
@binqiangliang4745
@binqiangliang4745 2 жыл бұрын
Same problem here, did you find a solution?
@harisai3580
@harisai3580 2 жыл бұрын
Belated happy birthday sir
@coffeedude
@coffeedude 2 жыл бұрын
Can you make a video on how to actually use the protobuf files? I'm going to use the method you are showcasing for the time being because the alternative was too difficult for me
@MatthewSmith-mt3kz
@MatthewSmith-mt3kz 11 ай бұрын
Thanks for another great tutorial.
@devandriev
@devandriev Жыл бұрын
Thanks, I can store user data in my app now
@arjunbhat6502
@arjunbhat6502 2 жыл бұрын
Error occured: kotlinx.serialization.SerializationException: Class 'SmallPersistentVector' is not registered for polymorphic serialization in the scope of 'PersistentList'.
@mohamedroshan3802
@mohamedroshan3802 Жыл бұрын
yes me too
@hargowins
@hargowins 9 ай бұрын
try using a mutableList instead of the persistentList
@valish_
@valish_ 11 ай бұрын
In wich package should i create the AppSettings and AppSetting Serializer in a MVVM project? Actually I created both clasess in my domain layer and use it throught my viewModel. Is that ok?
@johndominicjasmin
@johndominicjasmin 2 жыл бұрын
Great tutorial💚
@aravindsundar1955
@aravindsundar1955 2 жыл бұрын
How to handle data migration if we add new or modify the properties in AppSettings?
@seanthomas9398
@seanthomas9398 2 жыл бұрын
Typically local storage is behind a repository/data layer. I wonder if there's a clean yet convenient way to do this.
@Nostang3
@Nostang3 Жыл бұрын
Could you do a quick vid on using datastore in a viewmodel? I'm trying to apply this video to using it in a viewmodel but failing. I can't use the dataStore in the viewmodel after I create it.
@fixifaxhd772
@fixifaxhd772 9 ай бұрын
Great Video!
@Katzenmuetze
@Katzenmuetze Жыл бұрын
I stumbled upon this - nice video, but how does this work with Hilt?
@oliver_lauritsen_oa
@oliver_lauritsen_oa Жыл бұрын
I have a settings screen layout composable how can i access it from this it does not show up do i really need to create from activities
@hosenalzuhile3019
@hosenalzuhile3019 2 жыл бұрын
Thanks for explaining. would this work with parcelables classes?
@damianviltres2202
@damianviltres2202 2 жыл бұрын
Nice video, How can I get access to the dataStore into a viewModel class or other class. Thanks
@behnawm
@behnawm 2 жыл бұрын
I loved when Siri suddenly appeared😂
@renderset2937
@renderset2937 2 жыл бұрын
Philipp can you please make video on How to learn android development in kotlin from start Im really confused
@memeseed7062
@memeseed7062 2 жыл бұрын
probably
@redpanda8904
@redpanda8904 2 жыл бұрын
im also confused
@olohialli9289
@olohialli9289 2 жыл бұрын
check through his channel, there is a ton of tutorials on that
@aminsakha155
@aminsakha155 2 жыл бұрын
hey , did you really test adding item into knownLocations? it dose not work since its not workig with list of object when serializing
@hussien_fahmy
@hussien_fahmy 2 жыл бұрын
What the theme you are using in android studio please?
@muhammadsarimmehdi
@muhammadsarimmehdi 2 жыл бұрын
how do we reset the dataStore key values? Do we just reset them to the default values? Is there a one-line method for this
@winsonmac
@winsonmac 2 жыл бұрын
Nice!!
@mustafaammar551
@mustafaammar551 2 жыл бұрын
very cool thank you bro 👍👍👍
@kalidsherefuddin
@kalidsherefuddin Жыл бұрын
Thankseveryone
@mahdibahmanpour1495
@mahdibahmanpour1495 2 жыл бұрын
Is there any way to use it alongside the dagger hilt?
@ishantsharma16
@ishantsharma16 2 жыл бұрын
Great brother
@agungwatanabe318
@agungwatanabe318 2 жыл бұрын
how do you serialize PersistentList in moshi?
@PritamDas-rj5fk
@PritamDas-rj5fk Жыл бұрын
what is difference between proto datastore and Room database
@Monarch_943
@Monarch_943 2 жыл бұрын
Siri cracked me up XD
@haissayf
@haissayf 2 жыл бұрын
Why not just use room database, I've always wondered 🤔
@divid3d806
@divid3d806 2 жыл бұрын
I think creating and accessing database is more resource expensive
@haissayf
@haissayf 2 жыл бұрын
@@divid3d806 That makes sense, thanks for clarifying 👍
@muhammadsarimmehdi
@muhammadsarimmehdi 2 жыл бұрын
how would you inject this datastore with hilt?
@royss7656
@royss7656 2 жыл бұрын
We can write and read, but how to remove it from local storage
@divid3d806
@divid3d806 2 жыл бұрын
Does updateData uses Dispatchers.IO by defult?
@LakshyaMathersShady
@LakshyaMathersShady 2 жыл бұрын
What is the point of if u gonna convert to string and save it anyway? I dont see the use of proto buffs being here.
@PhilippLackner
@PhilippLackner 2 жыл бұрын
Type safety in preferences
@kommunismusarbeiterjonny
@kommunismusarbeiterjonny 2 жыл бұрын
@@PhilippLackner where is the fun though?😂
@jabrane1564
@jabrane1564 2 жыл бұрын
thanks
@nicomolon9096
@nicomolon9096 2 жыл бұрын
Hello guys, I'm trying to play it around and my code looks like this private suspend fun setLanguage(language: Language) { dataStore.updateData { it.copy( language = language, knownLocations = it.knownLocations.mutate { locationList -> locationList.add(Location(lat = 12345678.600, lng = 25664125.641)) }) } } is there anyone here try to save the list of Location and got an error like "kotlinx.serialization.SerializationException: Class 'SmallPersistentVector' is not registered for polymorphic serialization in the scope of 'PersistentList'. Mark the base class as 'sealed' or register the serializer explicitly." How can I soleve this error, Thank you in advance
Should You Use Compose State or StateFlow in Your ViewModels?
13:59
Philipp Lackner
Рет қаралды 80 М.
MAGIC TIME ​⁠@Whoispelagheya
00:28
MasomkaMagic
Рет қаралды 35 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2,5 МЛН
НИКИТА ПОДСТАВИЛ ДЖОНИ 😡
01:00
HOOOTDOGS
Рет қаралды 3,2 МЛН
Will A Basketball Boat Hold My Weight?
00:30
MrBeast
Рет қаралды 136 МЛН
Make Your Code Clean With the SOLID Principles
18:24
Philipp Lackner
Рет қаралды 100 М.
Preferences DataStore in 10min (SharedPreferences deprecated)
11:14
Philipp Lackner
Рет қаралды 76 М.
Full Guide to Delegation in Kotlin  - Android Studio Tutorial
18:10
Philipp Lackner
Рет қаралды 70 М.
Preferences Datastore with MVVM Architecture in Android Kotlin
17:02
Code With Kashif
Рет қаралды 6 М.
How to Validate Forms with Clean Architecture (You're Doing it Wrong)
41:08
MAGIC TIME ​⁠@Whoispelagheya
00:28
MasomkaMagic
Рет қаралды 35 МЛН