I am looking at this code in the file operation_response.dart from ferry_exec 0.3.1 https://pub.dev/packages/ferry_exec
enum DataSource {
/// A placeholder response source which can be used when waiting for another source
None,
/// Data originated from the client's [Link]
Link,
/// Data originated from the [Cache]
Cache,
/// Data originated from a user-provided [OperationRequest.optimisticResponse]
Optimistic,
}
From the comment, I understand that None is a placeholder while waiting for data, Cache is getting the data from cache, and Optimistic is the data from the request, but I don't understand what Link does. What does it mean and how do we use it?
From my observation I see that:
Linkacts like http requests and gets the actual data from the server's response.Optimisticis not really data from the link request, it is more like a placeholder like thenoneenum that you or the user manually provided (kinda like setStating a variable) to show a default or predicted outcome in the UI while the link request is operating and creating the real response. It's used to make the user experience smoother by showing results quicker than having to load until the link request responds.The
noneenum is also a placeholder but doesn't show any value, its just waiting for data to be returned. In either case bothOptimisticandNoneare temporary value, andLinkis data received from server.One way to see its usage in the package examples is to hold ctrl (or command on mac) + click the enum
The examples on there look complex. Since I am in-experienced with this library i'm not sure how to provide a simplified example for the time being