This commit is contained in:
Mguy13 2022-12-26 19:39:47 +01:00
parent 78fe9e7b09
commit c7324a6b19
458 changed files with 93141 additions and 47 deletions

View file

@ -1,5 +1,8 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import '/features/core/services/logging_service.dart';
import '../data/dtos/image_model_dto.dart';
/// Interface for implementing image-fetching strategies, specific to a resource location on the internet.
@ -7,10 +10,11 @@ import '../data/dtos/image_model_dto.dart';
/// Since I used a site that was more obscure than the ones in the examples, this (otherwise pointless
/// and convoluting) interface is for adding a bit of flexibility to change strategy to some other site.
abstract class ImagesApi {
ImagesApi({required String token}) : _token = token;
ImagesApi({required this.token});
/// Access token provided to be used with API calls
final String _token;
@protected
final String token;
/// Returns images fetched through an API as [ImageModelDTO]s.
FutureOr<Iterable<ImageModelDTO>> fetchImageUri();
@ -18,4 +22,7 @@ abstract class ImagesApi {
FutureOr<Iterable<ImageModelDTO>> searchImages({
required String searchStr,
});
@protected
final LoggingService loggingService = LoggingService.locate;
}