getApplicationDocumentsDirectory function Null safety On Android, this uses the getDataDirectory API on the context . Consider using getExternalStorageDirectory instead if data is intended to be visible to the user. Throws a MissingPlatformDirectoryException if the system is unable to provide the directory.