From 47ce44ee97beac32b78ac9827f73bba7d4f27115 Mon Sep 17 00:00:00 2001 From: xyzbilal Date: Sat, 5 Nov 2022 02:23:33 +0300 Subject: [PATCH] upgraded flutter version to null safety --- lib/gpt_3_dart.dart | 26 +++++++++++++------------- pubspec.yaml | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/gpt_3_dart.dart b/lib/gpt_3_dart.dart index d5c80f9..97562c4 100644 --- a/lib/gpt_3_dart.dart +++ b/lib/gpt_3_dart.dart @@ -1,11 +1,11 @@ library gpt3_dart; -import 'package:meta/meta.dart'; -import 'package:http/http.dart' as http; import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:http/http.dart' as http; + class Param { String name; @@ -20,10 +20,10 @@ class Param { } class OpenAI { - String apiKey; - OpenAI({@required this.apiKey}); + final String apiKey; + OpenAI({required this.apiKey}); - String getUrl(function, [engine]) { + Uri getUrl(function, [engine]) { List engineList = ['ada', 'babbage', 'curie', 'davinci']; String url = 'https://api.openai.com/v1/engines/davinci/$function'; @@ -31,17 +31,17 @@ class OpenAI { if (engineList.contains(engine)) { url = 'https://api.openai.com/v1/engines/$engine/$function'; } - return url; + return Uri.parse(url); } Future complete(String prompt, int maxTokens, - {num temperature, - num topP, - int n, - bool stream, - int logProbs, - bool echo, - String engine}) async { + {num? temperature, + num? topP, + int? n, + bool? stream, + int? logProbs, + bool? echo, + String? engine}) async { String apiKey = this.apiKey; List data = []; diff --git a/pubspec.yaml b/pubspec.yaml index 0a3f53e..65c5d96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,17 +1,17 @@ name: gpt_3_dart description: Unofficial Dart package for OpenAI's GPT-3 API. -version: 0.0.1 +version: 0.0.2 author: boron homepage: https://github.com/boronhub/gpt_3_dart.git environment: - sdk: ">=2.7.0 <3.0.0" - flutter: ">=1.17.0" + sdk: ">=2.18.0 <3.0.0" + flutter: ">=3.3.0" dependencies: flutter: sdk: flutter - http: ^0.12.2 + http: ^0.13.5 meta: dev_dependencies: