From 1ee24027a2a25d160a44e8705017600783caa66a Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Sun, 1 Dec 2024 09:49:00 +0100 Subject: [PATCH] Move bool to string to utils --- lib/src/external/sonarr.dart | 5 ++--- lib/src/util/util.dart | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/external/sonarr.dart b/lib/src/external/sonarr.dart index db889e3..9ab6010 100644 --- a/lib/src/external/sonarr.dart +++ b/lib/src/external/sonarr.dart @@ -1,8 +1,7 @@ import 'dart:convert'; import 'package:http/http.dart' as http; - -String _boolToString(bool boolValue) => boolValue ? 'true' : 'false'; +import 'package:running_on_dart/src/util/util.dart'; class Image { final String coverType; @@ -80,7 +79,7 @@ class SonarrClient { final response = await _get("/api/v3/calendar", parameters: { if (start != null) 'start': start.toIso8601String(), if (end != null) 'end': end.toIso8601String(), - if (includeSeries != null) 'includeSeries': _boolToString(includeSeries), + if (includeSeries != null) 'includeSeries': boolToString(includeSeries), }); final body = jsonDecode(response.body) as List; diff --git a/lib/src/util/util.dart b/lib/src/util/util.dart index ac5e0d0..b4758f5 100644 --- a/lib/src/util/util.dart +++ b/lib/src/util/util.dart @@ -97,6 +97,8 @@ bool boolValue(dynamic value) { return false; } +String boolToString(bool boolValue) => boolValue ? 'true' : 'false'; + extension ModalDataAsMap on ModalContext { Map asMap() { return interaction.data.components