ShortsRepository class abstract
Repository interface for fetching short-form content (stories).
Adapters implement this to provide shorts from various backends:
- WordPress custom post types
- Shopify metafields or blog posts
- Custom API endpoints
- Static JSON files
Example Implementation:
class WordPressShortsRepository implements ShortsRepository {
@override
Future<PaginatedResult<Short>> getShorts({
int page = 1,
int perPage = 20,
String? status,
Map<String, dynamic>? filters,
}) async {
// Fetch from WordPress REST API with post_type=shorts
final response = await http.get(...);
return PaginatedResult<Short>(...);
}
@override
Future<Short> getShortById(String id) async {
final response = await http.get('/wp-json/wp/v2/shorts/$id');
return Short.fromJson(response.data);
}
}
- Inheritance
-
- Object
- CoreRepository
- ShortsRepository
Constructors
Properties
- eventBus → EventBus
-
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hookRegistry → HookRegistry
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getShortById(
String id) → Future< Short> - Fetch a single short by its unique ID.
-
getShorts(
{int page = 1, int perPage = 20, String? status, Map< String, dynamic> ? filters}) → Future<PaginatedResult< Short> > - Fetch a paginated list of shorts.
-
initialize(
) → void -
Initialize the repository
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refreshShorts(
) → Future< void> - Optional: Refresh/invalidate cache for shorts data.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited