Skip to content

Commit

Permalink
Move bool to string to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Dec 1, 2024
1 parent 42890ae commit 1ee2402
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/src/external/sonarr.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<dynamic>;
Expand Down
2 changes: 2 additions & 0 deletions lib/src/util/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ bool boolValue(dynamic value) {
return false;
}

String boolToString(bool boolValue) => boolValue ? 'true' : 'false';

extension ModalDataAsMap on ModalContext {
Map<String, String?> asMap() {
return interaction.data.components
Expand Down

0 comments on commit 1ee2402

Please sign in to comment.