abdicate object assigning responsibility
The ImagesService itself handles the conversion of Json to the object itself, instead of the ImagesApi
This commit is contained in:
parent
a0ed894016
commit
6a84a9bef0
9 changed files with 255 additions and 25 deletions
|
@ -1,15 +1,13 @@
|
|||
import 'dart:async';
|
||||
|
||||
import '../data/models/image_model.dart';
|
||||
|
||||
/// Interface for implementing image-fetching strategies, specific to a resource location on the internet.
|
||||
///
|
||||
/// 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 {
|
||||
FutureOr<Iterable<ImageModel>> fetchImageUri({required String token});
|
||||
FutureOr<Iterable<Map<String, dynamic>>> fetchImageUri({required String token});
|
||||
|
||||
FutureOr<List<ImageModel>> searchImages({
|
||||
FutureOr<Iterable<Map<String, dynamic>>> searchImages({
|
||||
required String searchStr,
|
||||
required String token,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue