shouldMigrate

abstract suspend fun shouldMigrate(currentData: T): Boolean(source)

Return whether this migration needs to be performed. If this returns false, no migration or cleanup will occur. Apps should do the cheapest possible check to determine if this migration should run, since this will be called every time the DataStore is initialized. This method may be run multiple times when any failure is encountered.

Note that this will always be called before each call to migrate.

Note that accessing any data from DataStore directly from inside this function will result in deadlock, since DataStore doesn't return data until all migrations complete.

Parameters

currentData

the current data (which might already be populated from previous runs of this or other migrations)