From d8e6ccecff3a0066e0bd771fe15e9a61ff054a53 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Thu, 16 Nov 2023 08:26:46 +0100 Subject: [PATCH] chore(dynamite_end_to_end_test,nextcloud): Remove unnecessary casts Signed-off-by: jld3103 --- .../lib/request_body.openapi.dart | 2 +- packages/nextcloud/lib/src/api/notes.openapi.dart | 3 +-- packages/nextcloud/lib/src/webdav/client.dart | 6 +++--- packages/nextcloud/test/webdav_test.dart | 10 +++++----- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart b/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart index 07c67f84..eee85c07 100644 --- a/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart +++ b/packages/dynamite/dynamite_end_to_end_test/lib/request_body.openapi.dart @@ -117,7 +117,7 @@ class Client extends DynamiteClient { headers['Content-Type'] = 'application/octet-stream'; if (string != null) { - body = utf8.encode(string) as Uint8List; + body = utf8.encode(string); } const path = '/'; final uri = Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null); diff --git a/packages/nextcloud/lib/src/api/notes.openapi.dart b/packages/nextcloud/lib/src/api/notes.openapi.dart index 6b927643..a6cea824 100644 --- a/packages/nextcloud/lib/src/api/notes.openapi.dart +++ b/packages/nextcloud/lib/src/api/notes.openapi.dart @@ -676,8 +676,7 @@ class Client extends DynamiteClient { // coverage:ignore-end headers['Content-Type'] = 'application/json'; - body = utf8.encode(json.encode(_jsonSerializers.serialize(settings, specifiedType: const FullType(Settings)))) - as Uint8List; + body = utf8.encode(json.encode(_jsonSerializers.serialize(settings, specifiedType: const FullType(Settings)))); const path = '/index.php/apps/notes/api/v1/settings'; final uri = Uri(path: path, queryParameters: queryParameters.isNotEmpty ? queryParameters : null); diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 5288c506..e183cdaf 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -247,7 +247,7 @@ class WebDavClient { _constructUri(path), data: utf8.encode( WebDavPropfind(prop: prop ?? WebDavPropWithoutValues()).toXmlElement(namespaces: namespaces).toXmlString(), - ) as Uint8List, + ), headers: depth != null ? {'Depth': depth.value} : null, ), ); @@ -270,7 +270,7 @@ class WebDavClient { filterRules: filterRules, prop: prop ?? WebDavPropWithoutValues(), // coverage:ignore-line ).toXmlElement(namespaces: namespaces).toXmlString(), - ) as Uint8List, + ), ), ); @@ -293,7 +293,7 @@ class WebDavClient { set: set != null ? WebDavSet(prop: set) : null, remove: remove != null ? WebDavRemove(prop: remove) : null, ).toXmlElement(namespaces: namespaces).toXmlString(), - ) as Uint8List, + ), ); final data = await _parseResponse(response); for (final a in data.responses) { diff --git a/packages/nextcloud/test/webdav_test.dart b/packages/nextcloud/test/webdav_test.dart index a77abc34..2155aca1 100644 --- a/packages/nextcloud/test/webdav_test.dart +++ b/packages/nextcloud/test/webdav_test.dart @@ -260,7 +260,7 @@ void main() { }); test('Get directory props', () async { - final data = utf8.encode('test') as Uint8List; + final data = utf8.encode('test'); await client.webdav.mkcol(PathUri.parse('test')); await client.webdav.put(data, PathUri.parse('test/test.txt')); @@ -292,7 +292,7 @@ void main() { }); test('Filter files', () async { - final response = await client.webdav.put(utf8.encode('test') as Uint8List, PathUri.parse('test.txt')); + final response = await client.webdav.put(utf8.encode('test'), PathUri.parse('test.txt')); final id = response.headers['oc-fileid']!.first; await client.webdav.proppatch( PathUri.parse('test.txt'), @@ -325,7 +325,7 @@ void main() { final uploadTime = DateTime.now(); await client.webdav.put( - utf8.encode('test') as Uint8List, + utf8.encode('test'), PathUri.parse('test.txt'), lastModified: lastModifiedDate, created: createdDate, @@ -360,7 +360,7 @@ void main() { }); test('Remove properties', () async { - await client.webdav.put(utf8.encode('test') as Uint8List, PathUri.parse('test.txt')); + await client.webdav.put(utf8.encode('test'), PathUri.parse('test.txt')); var updated = await client.webdav.proppatch( PathUri.parse('test.txt'), @@ -446,7 +446,7 @@ void main() { ('put_get_utf8_segment', 'res-%e2%82%ac'), ]) { test(name, () async { - final content = utf8.encode('This is a test file') as Uint8List; + final content = utf8.encode('This is a test file'); final response = await client.webdav.put(content, PathUri.parse(path)); expect(response.statusCode, 201);