
Modern Android 13 Development Cookbook
By :

Figure 5.2 shows the differences between PreferencesDataStore
, SharedPreferences
, and ProtoDataStore
. In this recipe, we will explore how we can use Proto DataStore. The Proto DataStore implementation uses DataStore and Protocol Buffers to persist typed objects to the disk.
Proto DataStore is similar to Preferences DataStore, but unlike Preferences DataStore, Proto does not use key-value pairs and just returns the generated object in the flow. The file types and structure of the data depend on the schema of the .
protoc
files.
We will use our already created project to show how you can use Proto DataStore in Android. We will also use already created classes and just give the functions different names.
implementation "androidx.DataStore:DataStore...