Revision - Client Data Caching Technique (Persistent Storage) Flashcards

(8 cards)

1
Q

What are the three primary benefits of implementing client data caching in a mobile app?

A
  1. Offline Support : Enable to display data without internet connection
  2. Performance : Loading data from local device is faster than network request
  3. Cost Reduction : Prevents the app from constantly re-fetching same data from cloud database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which Flutter package should you use to store simple data types like the user’s theme preference (Light/Dark mode) or a simple authentication token?

A
shared_preferences
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which Flutter package should you use to stores files (5MB PDF report) that the user wants to view later

A
path_provider

Save the PDF directly to the device Application Documents Directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which Flutter package should you use to stores many data (List of expenses) that the user wants to view later?

A
sqflite

Data is highly structured and requires complex querying (Search expenses, filter expenses)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the major limitation or security warning regarding shared_preferences?

A
  1. It is not encrypted or secure by default
  2. We should never store highly sensitive data without using specialized secure storage package (flutter_secure_storage)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When reading/writing files using path_provider, what is the difference between the “Temporary Directory” and the “Application Documents Directory”?

A
  1. Temporary Directory(Cache): The OS can delete files at any time if the device runs low on storage
  2. Application Documents Directory: File stored here are permanent and will only be deleted if user unstalls the app
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In Flutter, reading or writing to local storage (SharedPreferences, SQLite, or Files) always returns what type of object? Why?

A

Future, because interacting with device’s hard drive takes time, it needs async and await to prevent blocking the UI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If you see the code SharedPreferences.getInstance() followed by prefs.setBool(‘isDarkMode’, true), what caching technique is being used?

A

Key-Value Store (using shared_preferences package)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly