Repository: coskuncay/flutter_chatgpt_api Branch: master Commit: 3d919e274cfe Files: 86 Total size: 89.9 KB Directory structure: gitextract_wlz1pty6/ ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android/ │ ├── app/ │ │ └── src/ │ │ └── main/ │ │ └── java/ │ │ └── io/ │ │ └── flutter/ │ │ └── plugins/ │ │ └── GeneratedPluginRegistrant.java │ └── local.properties ├── example/ │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── analysis_options.yaml │ ├── android/ │ │ ├── .gitignore │ │ ├── app/ │ │ │ ├── build.gradle │ │ │ └── src/ │ │ │ ├── debug/ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── main/ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin/ │ │ │ │ │ └── com/ │ │ │ │ │ └── example/ │ │ │ │ │ └── example/ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res/ │ │ │ │ ├── drawable/ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21/ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values/ │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night/ │ │ │ │ └── styles.xml │ │ │ └── profile/ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle/ │ │ │ └── wrapper/ │ │ │ └── gradle-wrapper.properties │ │ ├── gradle.properties │ │ └── settings.gradle │ ├── ios/ │ │ ├── .gitignore │ │ ├── Flutter/ │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner/ │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets/ │ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ │ └── Contents.json │ │ │ │ └── LaunchImage.imageset/ │ │ │ │ ├── Contents.json │ │ │ │ └── README.md │ │ │ ├── Base.lproj/ │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ │ ├── Runner.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace/ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata/ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata/ │ │ │ └── xcschemes/ │ │ │ └── Runner.xcscheme │ │ └── Runner.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ ├── lib/ │ │ └── main.dart │ ├── pubspec.yaml │ ├── test/ │ │ └── widget_test.dart │ └── web/ │ ├── index.html │ └── manifest.json ├── ios/ │ ├── Flutter/ │ │ ├── Generated.xcconfig │ │ └── flutter_export_environment.sh │ └── Runner/ │ ├── GeneratedPluginRegistrant.h │ └── GeneratedPluginRegistrant.m ├── lib/ │ ├── flutter_chatgpt_api.dart │ └── src/ │ ├── models/ │ │ ├── chat_message.model.dart │ │ ├── chat_response.model.dart │ │ ├── conversation_body.model.dart │ │ ├── conversation_response_event.model.dart │ │ ├── message.model.dart │ │ ├── message_content.model.dart │ │ ├── message_feedback_body.model.dart │ │ ├── message_feedback_result.model.dart │ │ ├── model.model.dart │ │ ├── model_result.model.dart │ │ ├── models.dart │ │ ├── moderation_body.model.dart │ │ ├── moderation_result.model.dart │ │ ├── prompt.model.dart │ │ ├── prompt_content.model.dart │ │ ├── session_result.model.dart │ │ └── user.model.dart │ └── utils/ │ ├── expiry_map.dart │ └── utils.dart ├── linux/ │ └── flutter/ │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── macos/ │ └── Flutter/ │ ├── GeneratedPluginRegistrant.swift │ └── ephemeral/ │ ├── Flutter-Generated.xcconfig │ └── flutter_export_environment.sh ├── pubspec.yaml ├── test/ │ └── flutter_chatgpt_test.dart └── windows/ └── flutter/ ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ migrate_working_dir/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. /pubspec.lock **/doc/api/ .dart_tool/ .packages build/ test/session_token.dart example/lib/session_token.dart test/clearance_token.dart example/lib/clearance_token.dart ================================================ FILE: .metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled and should not be manually edited. version: revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf channel: master project_type: package ================================================ FILE: CHANGELOG.md ================================================ ## 1.0.0 * Initial version. ## 1.1.0 * cf_clearance (clearanceToken) added. ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2022 Travis Fischer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # Flutter ChatGPT API This package is a Flutter/Dart API around [ChatGPT](https://openai.com/blog/chatgpt) by [OpenAI](https://openai.com). This package requires a valid session token from ChatGPT to access its unofficial REST API. This version have been updated to use Puppeteer to log in to ChatGPT and extract the Cloudflare cf_clearance cookie and OpenAI session token. 🔥 Thanks to [Node.js ChatGPT API](https://github.com/transitive-bullshit/chatgpt-api) (unofficial) - [Demo](#demo) - [Installation](#installation) - [Usage](#usage) - [SessionToken and ClearanceToken](#sessiontoken) - [License](#license) :warning: Be Careful! - Your `user-agent` and `IP address` **must match** from the real browser window you're logged in with to the one you're using for `ChatGPTAPI`. - This means that you currently can't log in with your laptop and then run the bot on a server or proxy somewhere. - Please check `defaultHeaders` ## Demo ## Installation ``` dependencies: flutter_chatgpt_api: ^1.0.0 ``` ## Usage ```dart import 'package:flutter_chatgpt_api/flutter_chatgpt_api.dart'; _api = ChatGPTApi( sessionToken: SESSION_TOKEN, clearanceToken: CLEARANCE_TOKEN, ); setState(() { _messages.add( ChatMessage( text: _textController.text, chatMessageType: ChatMessageType.user, ), ); isLoading = true; }); var newMessage = await _api.sendMessage( input, conversationId: _conversationId, parentMessageId: _parentMessageId, ); setState(() { _conversationId = newMessage.conversationId; _parentMessageId = newMessage.messageId; isLoading = false; _messages.add( ChatMessage( text: newMessage.message, chatMessageType: ChatMessageType.bot, ), ); }); ``` ## SessionToken To get a session token: 1. Go to https://chat.openai.com/chat and log in or sign up. 2. Open dev tools. 3. Open `Application` > `Cookies` (`Storage` > `Cookies`) ![image](https://user-images.githubusercontent.com/29631083/207098307-bbe78b3d-0704-42f2-828e-70e2b71691af.png) 4. Create these files and add your session token to run the tests and example respectively: Copy the value for __Secure-next-auth.session-token and save it to your environment.`example/lib/session_token.dart` Copy the value for cf_clearance and save it to your environment. `example/lib/clearance_token.dart` Should look something like this: ```dart const SESSION_TOKEN = '__Secure-next-auth.session-token from https://chat.openai.com/chat'; ``` ```dart const CLEARANCE_TOKEN = 'cf_clearance token from https://chat.openai.com/chat'; ``` ## Credit - Huge thanks to Travis Fischer for creating [Node.js ChatGPT API](https://github.com/transitive-bullshit/chatgpt-api) (unofficial) 💪 - Inspired by this [ChatGPT API Dart](https://github.com/MisterJimson/chatgpt_api_dart) by [Jason Rai](https://github.com/MisterJimson) ✨ ## License [MIT](https://choosealicense.com/licenses/mit/) Copyright (c) 2022, [Emre Coşkunçay](https://github.com/coskuncay) If you found this project interesting, please consider supporting my open source work by [sponsoring me](https://github.com/sponsors/coskuncay) or following me on twitter twitter ================================================ FILE: analysis_options.yaml ================================================ include: package:flutter_lints/flutter.yaml # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options ================================================ FILE: android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java ================================================ package io.flutter.plugins; import io.flutter.plugin.common.PluginRegistry; /** * Generated file. Do not edit. */ public final class GeneratedPluginRegistrant { public static void registerWith(PluginRegistry registry) { if (alreadyRegisteredWith(registry)) { return; } } private static boolean alreadyRegisteredWith(PluginRegistry registry) { final String key = GeneratedPluginRegistrant.class.getCanonicalName(); if (registry.hasPlugin(key)) { return true; } registry.registrarFor(key); return false; } } ================================================ FILE: android/local.properties ================================================ sdk.dir=C:\\Users\\EmreC\\AppData\\Local\\Android\\sdk flutter.sdk=C:\\src\\flutter ================================================ FILE: example/.gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ migrate_working_dir/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ /linux/ /windows/ /macos/ .pub/ /build/ # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile /android/app/release ================================================ FILE: example/.metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled. version: revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf channel: master project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: android create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: ios create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: linux create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: macos create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: web create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf - platform: windows create_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf base_revision: d9fb0dd8c6b49743aa59f14dd4327b11450948cf # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: example/README.md ================================================ # example A new Flutter project. ## Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is your first Flutter project: - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) For help getting started with Flutter development, view the [online documentation](https://docs.flutter.dev/), which offers tutorials, samples, guidance on mobile development, and a full API reference. ================================================ FILE: example/analysis_options.yaml ================================================ # This file configures the analyzer, which statically analyzes Dart code to # check for errors, warnings, and lints. # # The issues identified by the analyzer are surfaced in the UI of Dart-enabled # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be # invoked from the command line by running `flutter analyze`. # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints # and their documentation is published at # https://dart-lang.github.io/linter/lints/index.html. # # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code # or a specific dart file by using the `// ignore: name_of_lint` and # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options ================================================ FILE: example/android/.gitignore ================================================ gradle-wrapper.jar /.gradle /captures/ /gradlew /gradlew.bat /local.properties GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties **/*.keystore **/*.jks ================================================ FILE: example/android/app/build.gradle ================================================ def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.example" // You can update the following values to match your application needs. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } } flutter { source '../..' } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } ================================================ FILE: example/android/app/src/debug/AndroidManifest.xml ================================================ ================================================ FILE: example/android/app/src/main/AndroidManifest.xml ================================================ ================================================ FILE: example/android/app/src/main/kotlin/com/example/example/MainActivity.kt ================================================ package com.example.example import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { } ================================================ FILE: example/android/app/src/main/res/drawable/launch_background.xml ================================================ ================================================ FILE: example/android/app/src/main/res/drawable-v21/launch_background.xml ================================================ ================================================ FILE: example/android/app/src/main/res/values/styles.xml ================================================ ================================================ FILE: example/android/app/src/main/res/values-night/styles.xml ================================================ ================================================ FILE: example/android/app/src/profile/AndroidManifest.xml ================================================ ================================================ FILE: example/android/build.gradle ================================================ buildscript { ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } allprojects { repositories { google() mavenCentral() } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } task clean(type: Delete) { delete rootProject.buildDir } ================================================ FILE: example/android/gradle/wrapper/gradle-wrapper.properties ================================================ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip ================================================ FILE: example/android/gradle.properties ================================================ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true ================================================ FILE: example/android/settings.gradle ================================================ include ':app' def localPropertiesFile = new File(rootProject.projectDir, "local.properties") def properties = new Properties() assert localPropertiesFile.exists() localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" ================================================ FILE: example/ios/.gitignore ================================================ **/dgph *.mode1v3 *.mode2v3 *.moved-aside *.pbxuser *.perspectivev3 **/*sync/ .sconsign.dblite .tags* **/.vagrant/ **/DerivedData/ Icon? **/Pods/ **/.symlinks/ profile xcuserdata **/.generated/ Flutter/App.framework Flutter/Flutter.framework Flutter/Flutter.podspec Flutter/Generated.xcconfig Flutter/ephemeral/ Flutter/app.flx Flutter/app.zip Flutter/flutter_assets/ Flutter/flutter_export_environment.sh ServiceDefinitions.json Runner/GeneratedPluginRegistrant.* # Exceptions to above rules. !default.mode1v3 !default.mode2v3 !default.pbxuser !default.perspectivev3 ================================================ FILE: example/ios/Flutter/AppFrameworkInfo.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable App CFBundleIdentifier io.flutter.flutter.app CFBundleInfoDictionaryVersion 6.0 CFBundleName App CFBundlePackageType FMWK CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1.0 MinimumOSVersion 11.0 ================================================ FILE: example/ios/Flutter/Debug.xcconfig ================================================ #include "Generated.xcconfig" ================================================ FILE: example/ios/Flutter/Release.xcconfig ================================================ #include "Generated.xcconfig" ================================================ FILE: example/ios/Runner/AppDelegate.swift ================================================ import UIKit import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } } ================================================ FILE: example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "size" : "20x20", "idiom" : "iphone", "filename" : "Icon-App-20x20@2x.png", "scale" : "2x" }, { "size" : "20x20", "idiom" : "iphone", "filename" : "Icon-App-20x20@3x.png", "scale" : "3x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon-App-29x29@1x.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon-App-29x29@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "iphone", "filename" : "Icon-App-29x29@3x.png", "scale" : "3x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-App-40x40@2x.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-App-40x40@3x.png", "scale" : "3x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon-App-60x60@2x.png", "scale" : "2x" }, { "size" : "60x60", "idiom" : "iphone", "filename" : "Icon-App-60x60@3x.png", "scale" : "3x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "Icon-App-20x20@1x.png", "scale" : "1x" }, { "size" : "20x20", "idiom" : "ipad", "filename" : "Icon-App-20x20@2x.png", "scale" : "2x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon-App-29x29@1x.png", "scale" : "1x" }, { "size" : "29x29", "idiom" : "ipad", "filename" : "Icon-App-29x29@2x.png", "scale" : "2x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-App-40x40@1x.png", "scale" : "1x" }, { "size" : "40x40", "idiom" : "ipad", "filename" : "Icon-App-40x40@2x.png", "scale" : "2x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-App-76x76@1x.png", "scale" : "1x" }, { "size" : "76x76", "idiom" : "ipad", "filename" : "Icon-App-76x76@2x.png", "scale" : "2x" }, { "size" : "83.5x83.5", "idiom" : "ipad", "filename" : "Icon-App-83.5x83.5@2x.png", "scale" : "2x" }, { "size" : "1024x1024", "idiom" : "ios-marketing", "filename" : "Icon-App-1024x1024@1x.png", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "filename" : "LaunchImage.png", "scale" : "1x" }, { "idiom" : "universal", "filename" : "LaunchImage@2x.png", "scale" : "2x" }, { "idiom" : "universal", "filename" : "LaunchImage@3x.png", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md ================================================ # Launch Screen Assets You can customize the launch screen with your own desired assets by replacing the image files in this directory. You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. ================================================ FILE: example/ios/Runner/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: example/ios/Runner/Base.lproj/Main.storyboard ================================================ ================================================ FILE: example/ios/Runner/Info.plist ================================================ CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName Example CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName example CFBundlePackageType APPL CFBundleShortVersionString $(FLUTTER_BUILD_NAME) CFBundleSignature ???? CFBundleVersion $(FLUTTER_BUILD_NUMBER) LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIViewControllerBasedStatusBarAppearance CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents ================================================ FILE: example/ios/Runner/Runner-Bridging-Header.h ================================================ #import "GeneratedPluginRegistrant.h" ================================================ FILE: example/ios/Runner.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 54; objects = { /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; dstPath = ""; dstSubfolderSpec = 10; files = ( ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, ); name = Flutter; sourceTree = ""; }; 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, ); sourceTree = ""; }; 97C146EF1CF9000F007C117D /* Products */ = { isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, ); name = Products; sourceTree = ""; }; 97C146F01CF9000F007C117D /* Runner */ = { isa = PBXGroup; children = ( 97C146FA1CF9000F007C117D /* Main.storyboard */, 97C146FD1CF9000F007C117D /* Assets.xcassets */, 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 97C147021CF9000F007C117D /* Info.plist */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, ); path = Runner; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 97C146ED1CF9000F007C117D /* Runner */ = { isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, ); buildRules = ( ); dependencies = ( ); name = Runner; productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; LastSwiftMigration = 1100; }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; compatibilityVersion = "Xcode 9.3"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 97C146E51CF9000F007C117D; productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 97C146EC1CF9000F007C117D /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Thin Binary"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "Run Script"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 97C146EA1CF9000F007C117D /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 97C146FB1CF9000F007C117D /* Base */, ); name = Main.storyboard; sourceTree = ""; }; 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 97C147001CF9000F007C117D /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Profile; }; 249021D4217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Profile; }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 97C147061CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Debug; }; 97C147071CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, 97C147041CF9000F007C117D /* Release */, 249021D3217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147061CF9000F007C117D /* Debug */, 97C147071CF9000F007C117D /* Release */, 249021D4217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } ================================================ FILE: example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ================================================ PreviewsEnabled ================================================ FILE: example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme ================================================ ================================================ FILE: example/ios/Runner.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist ================================================ IDEDidComputeMac32BitWarning ================================================ FILE: example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings ================================================ PreviewsEnabled ================================================ FILE: example/lib/main.dart ================================================ import 'package:example/clearance_token.dart'; import 'package:example/session_token.dart'; import 'package:flutter/material.dart'; import 'package:flutter_chatgpt_api/flutter_chatgpt_api.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return const MaterialApp( title: 'Flutter ChatGPT API Example by justecdev', home: ChatPage(), debugShowCheckedModeBanner: false, ); } } const backgroundColor = Color(0xff343541); const botBackgroundColor = Color(0xff444654); class ChatPage extends StatefulWidget { const ChatPage({super.key}); @override State createState() => _ChatPageState(); } class _ChatPageState extends State { final _textController = TextEditingController(); final _scrollController = ScrollController(); final List _messages = []; late ChatGPTApi _api; String? _parentMessageId; String? _conversationId; late bool isLoading; @override void initState() { super.initState(); _api = ChatGPTApi( sessionToken: SESSION_TOKEN, clearanceToken: CLEARANCE_TOKEN, ); isLoading = false; } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( toolbarHeight: 100, title: const Padding( padding: EdgeInsets.all(8.0), child: Text( 'Flutter ChatGPT API Example @coskuncay', maxLines: 2, textAlign: TextAlign.center, ), ), backgroundColor: botBackgroundColor, ), backgroundColor: backgroundColor, body: SafeArea( child: Column( children: [ Expanded( child: _buildList(), ), Visibility( visible: isLoading, child: const Padding( padding: EdgeInsets.all(8.0), child: CircularProgressIndicator( color: Colors.white, ), ), ), Padding( padding: const EdgeInsets.all(8.0), child: Row( children: [ _buildInput(), _buildSubmit(), ], ), ), ], ), ), ); } Widget _buildSubmit() { return Visibility( visible: !isLoading, child: Container( color: botBackgroundColor, child: IconButton( icon: const Icon( Icons.send_rounded, color: Color.fromRGBO(142, 142, 160, 1), ), onPressed: () async { setState( () { _messages.add( ChatMessage( text: _textController.text, chatMessageType: ChatMessageType.user, ), ); isLoading = true; }, ); var input = _textController.text; _textController.clear(); Future.delayed(const Duration(milliseconds: 50)) .then((_) => _scrollDown()); var newMessage = await _api.sendMessage( input, conversationId: _conversationId, parentMessageId: _parentMessageId, ); setState(() { _conversationId = newMessage.conversationId; _parentMessageId = newMessage.messageId; isLoading = false; _messages.add( ChatMessage( text: newMessage.message, chatMessageType: ChatMessageType.bot, ), ); }); _textController.clear(); Future.delayed(const Duration(milliseconds: 50)) .then((_) => _scrollDown()); }, ), ), ); } Expanded _buildInput() { return Expanded( child: TextField( textCapitalization: TextCapitalization.sentences, style: const TextStyle(color: Colors.white), controller: _textController, decoration: const InputDecoration( fillColor: botBackgroundColor, filled: true, border: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none, errorBorder: InputBorder.none, disabledBorder: InputBorder.none, ), ), ); } ListView _buildList() { return ListView.builder( controller: _scrollController, itemCount: _messages.length, itemBuilder: (context, index) { var message = _messages[index]; return ChatMessageWidget( text: message.text, chatMessageType: message.chatMessageType, ); }, ); } void _scrollDown() { _scrollController.animateTo( _scrollController.position.maxScrollExtent, duration: const Duration(milliseconds: 300), curve: Curves.easeOut, ); } } class ChatMessageWidget extends StatelessWidget { const ChatMessageWidget( {super.key, required this.text, required this.chatMessageType}); final String text; final ChatMessageType chatMessageType; @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.symmetric(vertical: 10.0), padding: const EdgeInsets.all(16), color: chatMessageType == ChatMessageType.bot ? botBackgroundColor : backgroundColor, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ chatMessageType == ChatMessageType.bot ? Container( margin: const EdgeInsets.only(right: 16.0), child: CircleAvatar( backgroundColor: const Color.fromRGBO(16, 163, 127, 1), child: Image.asset( 'assets/bot.png', color: Colors.white, scale: 1.5, ), ), ) : Container( margin: const EdgeInsets.only(right: 16.0), child: const CircleAvatar( child: Icon( Icons.person, ), ), ), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( padding: const EdgeInsets.all(8.0), decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(8.0)), ), child: Text( text, style: Theme.of(context) .textTheme .bodyLarge ?.copyWith(color: Colors.white), ), ), ], ), ), ], ), ); } } ================================================ FILE: example/pubspec.yaml ================================================ name: example description: A new Flutter project. # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 # followed by an optional build number separated by a +. # Both the version and the builder number may be overridden in flutter # build by specifying --build-name and --build-number, respectively. # In Android, build-name is used as versionName while build-number used as versionCode. # Read more about Android versioning at https://developer.android.com/studio/publish/versioning # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: sdk: '>=2.19.0-406.0.dev <3.0.0' # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions # consider running `flutter pub upgrade --major-versions`. Alternatively, # dependencies can be manually updated by changing the version numbers below to # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter flutter_chatgpt_api: path: ../ # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. flutter_lints: ^2.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: assets: - assets/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware # For details regarding adding assets from package dependencies, see # https://flutter.dev/assets-and-images/#from-packages # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts from package dependencies, # see https://flutter.dev/custom-fonts/#from-packages ================================================ FILE: example/test/widget_test.dart ================================================ // This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. // await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); } ================================================ FILE: example/web/index.html ================================================ example ================================================ FILE: example/web/manifest.json ================================================ { "name": "example", "short_name": "example", "start_url": ".", "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", "description": "A new Flutter project.", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ { "src": "icons/Icon-192.png", "sizes": "192x192", "type": "image/png" }, { "src": "icons/Icon-512.png", "sizes": "512x512", "type": "image/png" }, { "src": "icons/Icon-maskable-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" }, { "src": "icons/Icon-maskable-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" } ] } ================================================ FILE: ios/Flutter/Generated.xcconfig ================================================ // This is a generated file; do not edit or check into version control. FLUTTER_ROOT=C:\src\flutter FLUTTER_APPLICATION_PATH=C:\projects\flutter_chatgpt COCOAPODS_PARALLEL_CODE_SIGN=true FLUTTER_TARGET=lib\main.dart FLUTTER_BUILD_DIR=build FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1.0.0 EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false PACKAGE_CONFIG=.dart_tool/package_config.json ================================================ FILE: ios/Flutter/flutter_export_environment.sh ================================================ #!/bin/sh # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=C:\src\flutter" export "FLUTTER_APPLICATION_PATH=C:\projects\flutter_chatgpt" export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_TARGET=lib\main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1.0.0" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" export "PACKAGE_CONFIG=.dart_tool/package_config.json" ================================================ FILE: ios/Runner/GeneratedPluginRegistrant.h ================================================ // // Generated file. Do not edit. // // clang-format off #ifndef GeneratedPluginRegistrant_h #define GeneratedPluginRegistrant_h #import NS_ASSUME_NONNULL_BEGIN @interface GeneratedPluginRegistrant : NSObject + (void)registerWithRegistry:(NSObject*)registry; @end NS_ASSUME_NONNULL_END #endif /* GeneratedPluginRegistrant_h */ ================================================ FILE: ios/Runner/GeneratedPluginRegistrant.m ================================================ // // Generated file. Do not edit. // // clang-format off #import "GeneratedPluginRegistrant.h" @implementation GeneratedPluginRegistrant + (void)registerWithRegistry:(NSObject*)registry { } @end ================================================ FILE: lib/flutter_chatgpt_api.dart ================================================ library flutter_chatgpt_api; import 'dart:convert'; import 'dart:io'; import 'package:flutter_chatgpt_api/src/models/models.dart'; import 'package:flutter_chatgpt_api/src/utils/utils.dart'; import 'package:http/http.dart' as http; import 'package:uuid/uuid.dart'; part 'src/models/chat_message.model.dart'; class ChatGPTApi { String sessionToken; String clearanceToken; String? apiBaseUrl; String backendApiBaseUrl; String userAgent; final ExpiryMap _accessTokenCache = ExpiryMap(); ChatGPTApi({ required this.sessionToken, required this.clearanceToken, this.apiBaseUrl = 'https://chat.openai.com/api', this.backendApiBaseUrl = 'https://chat.openai.com/backend-api', this.userAgent = defaultUserAgent, }); Map defaultHeaders = { 'user-agent': defaultUserAgent, 'x-openai-assistant-app-id': '', 'accept-language': 'en-US,en;q=0.9', HttpHeaders.accessControlAllowOriginHeader: 'https://chat.openai.com', HttpHeaders.refererHeader: 'https://chat.openai.com/chat', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', }; Future sendMessage( String message, { String? conversationId, String? parentMessageId, }) async { final accessToken = await _refreshAccessToken(); parentMessageId ??= const Uuid().v4(); final body = ConversationBody( action: 'next', conversationId: conversationId, messages: [ Prompt( content: PromptContent(contentType: 'text', parts: [message]), id: const Uuid().v4(), role: 'user', ) ], model: 'text-davinci-002-render', parentMessageId: parentMessageId, ); final url = '$backendApiBaseUrl/conversation'; final response = await http.post( Uri.parse(url), headers: { 'user-agent': defaultUserAgent, 'x-openai-assistant-app-id': '', 'accept-language': 'en-US,en;q=0.9', HttpHeaders.accessControlAllowOriginHeader: 'https://chat.openai.com', HttpHeaders.refererHeader: 'https://chat.openai.com/chat', 'sec-ch-ua': '"Not?A_Brand";v="8", "Chromium";v="108", "Google Chrome";v="108"', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'Authorization': 'Bearer $accessToken', 'Content-Type': 'application/json', 'Accept': 'text/event-stream', 'Cookie': 'cf_clearance=$clearanceToken' }, body: body.toJson(), ); if (response.statusCode != 200) { if (response.statusCode == 429) { throw Exception('Rate limited'); } else { throw Exception('Failed to send message'); } } else if (_errorMessages.contains(response.body)) { throw Exception('OpenAI returned an error'); } String longestLine = response.body.split('\n').reduce((a, b) => a.length > b.length ? a : b); var result = longestLine.replaceFirst('data: ', ''); var messageResult = ConversationResponseEvent.fromJson(result); var lastResult = messageResult.message?.content.parts.first; if (lastResult == null) { throw Exception('No response from OpenAI'); } else { return ChatResponse( message: lastResult, messageId: messageResult.message!.id, conversationId: messageResult.conversationId, ); } } Future _refreshAccessToken() async { final cachedAccessToken = _accessTokenCache['KEY_ACCESS_TOKEN']; if (cachedAccessToken != null) { return cachedAccessToken; } try { final res = await http.get( Uri.parse('$apiBaseUrl/auth/session'), headers: { 'cookie': 'cf_clearance=$clearanceToken;__Secure-next-auth.session-token=$sessionToken', 'accept': '*/*', ...defaultHeaders, }, ); if (res.statusCode != 200) { throw Exception('Failed to refresh access token'); } final accessToken = jsonDecode(res.body)['accessToken']; if (accessToken == null) { throw Exception( 'Failed to refresh access token, token in response is null'); } _accessTokenCache['KEY_ACCESS_TOKEN'] = accessToken; return accessToken; } catch (err) { throw Exception('ChatGPT failed to refresh auth token: $err'); } } } const defaultUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'; const _errorMessages = [ "{\"detail\":\"Hmm...something seems to have gone wrong. Maybe try me again in a little bit.\"}", ]; ================================================ FILE: lib/src/models/chat_message.model.dart ================================================ part of flutter_chatgpt_api; enum ChatMessageType { user, bot } class ChatMessage { ChatMessage({ required this.text, required this.chatMessageType, }); final String text; final ChatMessageType chatMessageType; } ================================================ FILE: lib/src/models/chat_response.model.dart ================================================ import 'dart:convert'; class ChatResponse { final String message; final String messageId; final String conversationId; ChatResponse({ required this.message, required this.messageId, required this.conversationId, }); Map toMap() { return { 'message': message, 'message_id': messageId, 'conversation_id': conversationId, }; } factory ChatResponse.fromMap(Map map) { return ChatResponse( message: map['message'] ?? '', messageId: map['message_id'] ?? '', conversationId: map['conversation_id'] ?? '', ); } String toJson() => json.encode(toMap()); factory ChatResponse.fromJson(String source) => ChatResponse.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/conversation_body.model.dart ================================================ import 'dart:convert'; import 'package:flutter_chatgpt_api/src/models/models.dart'; class ConversationBody { final String? action; final String? conversationId; final List? messages; final String model; final String parentMessageId; ConversationBody({ required this.action, required this.conversationId, required this.messages, required this.model, required this.parentMessageId, }); Map toMap() { return { 'action': action, 'conversation_id': conversationId, 'messages': messages?.map((x) => x.toMap()).toList(), 'model': model, 'parent_message_id': parentMessageId, }; } factory ConversationBody.fromMap(Map map) { return ConversationBody( action: map['action'], conversationId: map['conversation_id'], messages: map['messages'] != null ? List.from(map['messages']?.map((x) => Prompt.fromMap(x))) : null, model: map['model'] ?? '', parentMessageId: map['parent_message_id'] ?? '', ); } String toJson() => json.encode(toMap()); factory ConversationBody.fromJson(String source) => ConversationBody.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/conversation_response_event.model.dart ================================================ import 'dart:convert'; import 'package:flutter_chatgpt_api/src/models/models.dart'; class ConversationResponseEvent { final Message? message; final String conversationId; final String? error; ConversationResponseEvent({ required this.message, required this.conversationId, required this.error, }); Map toMap() { return { 'message': message?.toMap(), 'conversation_id': conversationId, 'error': error, }; } factory ConversationResponseEvent.fromMap(Map map) { return ConversationResponseEvent( message: map['message'] != null ? Message.fromMap(map['message']) : null, conversationId: map['conversation_id'] ?? '', error: map['error'], ); } String toJson() => json.encode(toMap()); factory ConversationResponseEvent.fromJson(String source) => ConversationResponseEvent.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/message.model.dart ================================================ import 'dart:convert'; import 'package:flutter_chatgpt_api/src/models/message_content.model.dart'; class Message { final String id; final MessageContent content; final String role; final String? user; //final dynamic endTurn; final double weight; final String recipient; //final dynamic metadata; Message({ required this.id, required this.content, required this.role, required this.user, required this.weight, required this.recipient, }); Map toMap() { return { 'id': id, 'content': content.toMap(), 'role': role, 'user': user, 'weight': weight, 'recipient': recipient, }; } factory Message.fromMap(Map map) { return Message( id: map['id'] ?? '', content: MessageContent.fromMap(map['content']), role: map['role'] ?? '', user: map['user'], weight: map['weight']?.toDouble() ?? 0.0, recipient: map['recipient'] ?? '', ); } String toJson() => json.encode(toMap()); factory Message.fromJson(String source) => Message.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/message_content.model.dart ================================================ import 'dart:convert'; class MessageContent { final String contentType; final List parts; MessageContent({ required this.contentType, required this.parts, }); Map toMap() { return { 'content_type': contentType, 'parts': parts, }; } factory MessageContent.fromMap(Map map) { return MessageContent( contentType: map['content_type'] ?? '', parts: List.from(map['parts']), ); } String toJson() => json.encode(toMap()); factory MessageContent.fromJson(String source) => MessageContent.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/message_feedback_body.model.dart ================================================ import 'package:flutter_chatgpt_api/src/models/message_feedback_result.model.dart'; enum MessageFeedbackTags { harmful, falseValue, // false is a reserved word notHelpful, } class MessageFeedbackBody { final String conversationId; final String messageId; final MessageFeedbackResult rating; final List? tags; final String? text; MessageFeedbackBody({ required this.conversationId, required this.messageId, required this.rating, required this.tags, required this.text, }); } ================================================ FILE: lib/src/models/message_feedback_result.model.dart ================================================ enum MessageFeedbackRating { thumbsUp, thumbsDown, } class MessageFeedbackResult { final String messageId; final String conversationId; final String userId; final MessageFeedbackRating rating; final String? text; MessageFeedbackResult({ required this.messageId, required this.conversationId, required this.userId, required this.rating, required this.text, }); } ================================================ FILE: lib/src/models/model.model.dart ================================================ import 'dart:convert'; class Model { final String slug; final int maxTokens; final bool isSpecial; Model({ required this.slug, required this.maxTokens, required this.isSpecial, }); Map toMap() { return { 'slug': slug, 'maxTokens': maxTokens, 'isSpecial': isSpecial, }; } factory Model.fromMap(Map map) { return Model( slug: map['slug'] ?? '', maxTokens: map['maxTokens']?.toInt() ?? 0, isSpecial: map['isSpecial'] ?? false, ); } String toJson() => json.encode(toMap()); factory Model.fromJson(String source) => Model.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/model_result.model.dart ================================================ import 'package:flutter_chatgpt_api/src/models/model.model.dart'; class ModelsResult { final List models; ModelsResult({ required this.models, }); } ================================================ FILE: lib/src/models/models.dart ================================================ export 'chat_response.model.dart'; export 'conversation_body.model.dart'; export 'conversation_response_event.model.dart'; export 'message_content.model.dart'; export 'message_feedback_body.model.dart'; export 'message_feedback_result.model.dart'; export 'message.model.dart'; export 'model_result.model.dart'; export 'model.model.dart'; export 'moderation_body.model.dart'; export 'moderation_result.model.dart'; export 'prompt_content.model.dart'; export 'prompt.model.dart'; export 'session_result.model.dart'; export 'user.model.dart'; ================================================ FILE: lib/src/models/moderation_body.model.dart ================================================ enum AvailableModerationModels { textModerationPlayground, } class ModerationsBody { final String input; final AvailableModerationModels model; ModerationsBody({ required this.input, required this.model, }); } ================================================ FILE: lib/src/models/moderation_result.model.dart ================================================ class ModerationsResult { final bool flagged; final bool blocked; final String moderationId; ModerationsResult({ required this.flagged, required this.blocked, required this.moderationId, }); } ================================================ FILE: lib/src/models/prompt.model.dart ================================================ import 'dart:convert'; import 'package:flutter_chatgpt_api/src/models/models.dart'; class Prompt { final PromptContent content; final String id; final String role; Prompt({ required this.content, required this.id, required this.role, }); Map toMap() { return { 'content': content.toMap(), 'id': id, 'role': role, }; } factory Prompt.fromMap(Map map) { return Prompt( content: PromptContent.fromMap(map['content']), id: map['id'] ?? '', role: map['role'] ?? '', ); } String toJson() => json.encode(toMap()); factory Prompt.fromJson(String source) => Prompt.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/prompt_content.model.dart ================================================ import 'dart:convert'; class PromptContent { final String contentType; final List parts; PromptContent({ required this.contentType, required this.parts, }); Map toMap() { return { 'content_type': contentType, 'parts': parts, }; } factory PromptContent.fromMap(Map map) { return PromptContent( contentType: map['content_type'] ?? '', parts: List.from(map['parts']), ); } String toJson() => json.encode(toMap()); factory PromptContent.fromJson(String source) => PromptContent.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/session_result.model.dart ================================================ import 'dart:convert'; import 'package:flutter_chatgpt_api/src/models/models.dart'; class SessionResult { final User user; final String expires; final String accessToken; SessionResult({ required this.user, required this.expires, required this.accessToken, }); Map toMap() { return { 'user': user.toMap(), 'expires': expires, 'accessToken': accessToken, }; } factory SessionResult.fromMap(Map map) { return SessionResult( user: User.fromMap(map['user']), expires: map['expires'] ?? '', accessToken: map['accessToken'] ?? '', ); } String toJson() => json.encode(toMap()); factory SessionResult.fromJson(String source) => SessionResult.fromMap(json.decode(source)); } ================================================ FILE: lib/src/models/user.model.dart ================================================ import 'dart:convert'; class User { final String id; final String name; final String email; final String image; final String picture; final List groups; final List features; User({ required this.id, required this.name, required this.email, required this.image, required this.picture, required this.groups, required this.features, }); Map toMap() { return { 'id': id, 'name': name, 'email': email, 'image': image, 'picture': picture, 'groups': groups, 'features': features, }; } factory User.fromMap(Map map) { return User( id: map['id'] ?? '', name: map['name'] ?? '', email: map['email'] ?? '', image: map['image'] ?? '', picture: map['picture'] ?? '', groups: List.from(map['groups']), features: List.from(map['features']), ); } String toJson() => json.encode(toMap()); factory User.fromJson(String source) => User.fromMap(json.decode(source)); } ================================================ FILE: lib/src/utils/expiry_map.dart ================================================ class ExpiryMap { final Map _map = {}; V? operator [](K key) => _map[key]; void operator []=(K key, V value) { _map[key] = value; Future.delayed(const Duration(seconds: 10), () => _map.remove(key)); } } ================================================ FILE: lib/src/utils/utils.dart ================================================ export 'expiry_map.dart'; ================================================ FILE: linux/flutter/generated_plugin_registrant.cc ================================================ // // Generated file. Do not edit. // // clang-format off #include "generated_plugin_registrant.h" void fl_register_plugins(FlPluginRegistry* registry) { } ================================================ FILE: linux/flutter/generated_plugin_registrant.h ================================================ // // Generated file. Do not edit. // // clang-format off #ifndef GENERATED_PLUGIN_REGISTRANT_ #define GENERATED_PLUGIN_REGISTRANT_ #include // Registers Flutter plugins. void fl_register_plugins(FlPluginRegistry* registry); #endif // GENERATED_PLUGIN_REGISTRANT_ ================================================ FILE: linux/flutter/generated_plugins.cmake ================================================ # # Generated file, do not edit. # list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST ) set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) endforeach(ffi_plugin) ================================================ FILE: macos/Flutter/GeneratedPluginRegistrant.swift ================================================ // // Generated file. Do not edit. // import FlutterMacOS import Foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { } ================================================ FILE: macos/Flutter/ephemeral/Flutter-Generated.xcconfig ================================================ // This is a generated file; do not edit or check into version control. FLUTTER_ROOT=C:\src\flutter FLUTTER_APPLICATION_PATH=C:\projects\flutter_chatgpt COCOAPODS_PARALLEL_CODE_SIGN=true FLUTTER_BUILD_DIR=build FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1.0.0 DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false PACKAGE_CONFIG=.dart_tool/package_config.json ================================================ FILE: macos/Flutter/ephemeral/flutter_export_environment.sh ================================================ #!/bin/sh # This is a generated file; do not edit or check into version control. export "FLUTTER_ROOT=C:\src\flutter" export "FLUTTER_APPLICATION_PATH=C:\projects\flutter_chatgpt" export "COCOAPODS_PARALLEL_CODE_SIGN=true" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1.0.0" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" export "PACKAGE_CONFIG=.dart_tool/package_config.json" ================================================ FILE: pubspec.yaml ================================================ name: flutter_chatgpt_api description: Flutter/Dart API around ChatGPT for the unofficial ChatGPT API. version: 1.1.0 homepage: https://github.com/coskuncay/flutter_chatgpt_api repository: https://github.com/coskuncay/flutter_chatgpt_api environment: sdk: '>=2.18.2 <3.0.0' flutter: ">=1.17.0" dependencies: http: ^0.13.5 uuid: ^3.0.7 dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^2.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec # The following section is specific to Flutter packages. flutter: # To add assets to your package, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # # For details regarding assets in packages, see # https://flutter.dev/assets-and-images/#from-packages # # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware # To add custom fonts to your package, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # fonts: # - family: Schyler # fonts: # - asset: fonts/Schyler-Regular.ttf # - asset: fonts/Schyler-Italic.ttf # style: italic # - family: Trajan Pro # fonts: # - asset: fonts/TrajanPro.ttf # - asset: fonts/TrajanPro_Bold.ttf # weight: 700 # # For details regarding fonts in packages, see # https://flutter.dev/custom-fonts/#from-packages ================================================ FILE: test/flutter_chatgpt_test.dart ================================================ import 'package:flutter_chatgpt_api/flutter_chatgpt_api.dart'; import 'package:flutter_test/flutter_test.dart'; import 'clearance_token.dart'; import 'session_token.dart'; void main() { test('do basic prompt', () async { final api = ChatGPTApi( sessionToken: SESSION_TOKEN, clearanceToken: CLEARANCE_TOKEN); const prompt = 'Write a python version of bubble sort. Do not include example usage.'; var result = await api.sendMessage(prompt); // ignore: avoid_print print(result); }); } ================================================ FILE: windows/flutter/generated_plugin_registrant.cc ================================================ // // Generated file. Do not edit. // // clang-format off #include "generated_plugin_registrant.h" void RegisterPlugins(flutter::PluginRegistry* registry) { } ================================================ FILE: windows/flutter/generated_plugin_registrant.h ================================================ // // Generated file. Do not edit. // // clang-format off #ifndef GENERATED_PLUGIN_REGISTRANT_ #define GENERATED_PLUGIN_REGISTRANT_ #include // Registers Flutter plugins. void RegisterPlugins(flutter::PluginRegistry* registry); #endif // GENERATED_PLUGIN_REGISTRANT_ ================================================ FILE: windows/flutter/generated_plugins.cmake ================================================ # # Generated file, do not edit. # list(APPEND FLUTTER_PLUGIN_LIST ) list(APPEND FLUTTER_FFI_PLUGIN_LIST ) set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) endforeach(ffi_plugin)