'context.createDatabase is not finding in preferences DataStore Android

I've just implemented Preferences by Android DataStore but I can't find "context.createDataStore" I added this dependency below

implementation "androidx.datastore:datastore-preferences:1.0.0"

and also I did clean and Rebuild Project but I can't find createDataStore function



Solution 1:[1]

I had the same problem and, I think that context.createDatastore isn't yet in this version I tried with this dependency version

"androidx.datastore:datastore-preferences:1.0.0-alpha01"

and it worked for me but be careful this version is not yet stable.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kaveh