medz / prisma-dart

Prisma Client Dart is an auto-generated type-safe ORM. It uses Prisma Engine as the data access layer and is as consistent as possible with the Prisma Client JS/TS APIs.
https://prisma.pub
BSD 3-Clause "New" or "Revised" License
436 stars 29 forks source link

MSSQL Bytes tries to cast String? as List<dynamic>? with error #282

Closed Fr0ssT closed 3 months ago

Fr0ssT commented 8 months ago

Prisma schema of Image Bytes? @db.Image generates: image: (json['Image'] as List<dynamic>?)?.map((e) => e as int).toList()

When it executes I get: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'String' is not a subtype of type 'List<dynamic>?' in type cast

Changing the generated code to: image: json['Image'] != null? base64Decode((json['Image'] as String)) : null works for me. Is there an actual solution?

I'm on Dart 3.1.5 on linux_x64.

How would I achieve this? Just using schema of string would work, but I get: Error converting field "Image" of expected non-nullable type "String", found incompatible value of

medz commented 8 months ago

New versions are being developed and older versions cannot keep up with Prisma updates.