anasfik / openai

Dart/Flutter SDK for ChatGPT and all OpenAI APIs (GPT, Dall-e..)
https://pub.dev/packages/dart_openai
MIT License
593 stars 186 forks source link

Build failed | solving by adding imports | Error: Type 'Uint8List' not found. | Error: 'MultipartFile' isn't a type. #184

Open Stefano-Trinca opened 5 months ago

Stefano-Trinca commented 5 months ago

I have e build failure with the following errors:

    Uint8List? fileData,
    ^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/dart_openai-5.1.0/lib/src/core/networking/client.dart:548:5: Error: 'Uint8List' isn't a type.
    Uint8List? fileData,
    ^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/dart_openai-5.1.0/lib/src/core/networking/client.dart:563:5: Error: 'MultipartFile' isn't a type.
    MultipartFile multiPartFile;
    ^^^^^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/dart_openai-5.1.0/lib/src/instance/audio/audio.dart:52:5: Error: Type 'Uint8List' not found.
    Uint8List? fileData,
    ^^^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dev/dart_openai-5.1.0/lib/src/instance/audio/audio.dart:52:5: Error: 'Uint8List' isn't a type.
    Uint8List? fileData,
    ^^^^^^^^^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

This can be solved by adding the: import 'dart:typed_data'; on audio.dart and client.dart files.

Then in the client.dart file in the 565 line is missin http. before MultipartFile: http.MultipartFile multiPartFile;