Skip to content

Commit ee5353d

Browse files
committed
fix: use correct type for byte array values (original patch by @odig)
1 parent f803567 commit ee5353d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Kiota.Builder/Writers/Dart/CodeMethodWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private string GetDeserializationMethodName(CodeTypeBase propType, CodeMethod me
461461
{
462462
"Iterable<int>" => "getCollectionOfPrimitiveValues<int>()",
463463
"UuidValue" => "getGuidValue()",
464-
"byte[]" => "getByteArrayValue()",
464+
"Uint8List" => "getByteArrayValue()",
465465
_ when conventions.IsPrimitiveType(propertyType) => $"get{propertyType.TrimEnd(DartConventionService.NullableMarker).ToFirstCharacterUpperCase()}Value()",
466466
_ => $"getObjectValue<{propertyType.ToFirstCharacterUpperCase()}>({propertyType}.createFromDiscriminatorValue)",
467467
};
@@ -810,7 +810,7 @@ private string GetSerializationMethodName(CodeTypeBase propType, CodeMethod meth
810810

811811
return propertyType switch
812812
{
813-
"byte[]" => "writeByteArrayValue",
813+
"Uint8List" => "writeByteArrayValue",
814814
"String" => "writeStringValue",
815815
"Iterable<int>" => "writeCollectionOfPrimitiveValues<int>",
816816
"UuidValue" => "writeUuidValue",

src/Kiota.Builder/Writers/Dart/DartConventionService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ public override string TranslateType(CodeType type)
230230
"string" => "String",
231231
"double" or "float" or "decimal" => "double",
232232
"object" or "void" => type.Name.ToLowerInvariant(),// little casing hack
233-
"binary" or "base64" or "base64url" => "Iterable<int>",
233+
"binary" => "Iterable<int>",
234+
"base64" or "base64url" => "Uint8List",
234235
string s when s.Contains("RequestConfiguration", StringComparison.OrdinalIgnoreCase) => "RequestConfiguration",
235236
"iparsenode" => "ParseNode",
236237
"iserializationwriter" => "SerializationWriter",

0 commit comments

Comments
 (0)