(draft) `Day 68` - Read Medium article: _<https://...
# 100daysofkotlin-2021
b
(draft)
Day 68
• Read Medium article: Jetpack Proto DataStore with Kotlin generated classes for Proto schemaImplement DataStore In Daily Doc(was not able to succesfully implement. Tried using Proto, but switched to Preferences at the end of the night. It's coming along, but not finished)
Self-Comment
• I swapped from trying to use DataStore Preferences to DataStore Proto (type safe version) ◦ After some trial and error struggling with implementing a secured version of datastore it finally works without errors. Took some time to figure out how to implement the proto class (message UserData) into various files. ◦ ...Spent the day trying to implement DataStore Proto, but could not get it to actually work. I will try to swap to DataStore Preferences, but I may just use SharedPref. SharedPreferences is a heck of a lot easier to use compared to trying to implement Datastore! Perhaps my biggest issue here is that there just isn't any up to date examples for what I'm looking for, and I'm too unfamiliar with Datastore/caching to figure it out myself.. 🤔
Struggled implementing
Copy code
val Context.userDataStore: DataStore<UserData> by dataStore(
    fileName = DATA_STORE_FILE_NAME,
    serializer = UserSerializer
)
as dataStore was not recognize. After trying various things, I rechecked the dependencies and noticed
Copy code
implementation  "androidx.datastore:datastore-core:1.0.0-beta01"
was implemented, but did not have
Copy code
implementation  "androidx.datastore:datastore:1.0.0-beta01"
which was required. Only needed for this single import. I suppose it has something to do with proto datastore after alpha 07