import 'dart:convert'; import '../log/log.dart'; import '../types/actor.dart'; import 'api.dart'; Future> loadAllActors() async { final data = await API.query("actor", "getAllActors", {}); final d = (jsonDecode(data) ?? []) as List; final actors = d.map((e) => Actor.fromJson(e)).toList(growable: false); return actors; } Future> loadActorsOfVideo(int movieId) async { final data = await API.query("actor", "getActorsOfVideo", {'MovieId': movieId}); if (data == 'null') { return []; } final d = jsonDecode(data); List dta = (d as List).map((e) => Actor.fromJson(e)).toList(); return dta; } Future addActorToVideo(int actorId, int movieId) async { final data = await API.query( "actor", "addActorToVideo", {'ActorId': actorId, 'MovieId': movieId}); final d = jsonDecode(data); if (d["result"] != "success") { Log.w("couldn't add actor to video"); } }