diff --git a/packages/fl_query/example/.flutter-plugins b/packages/fl_query/example/.flutter-plugins new file mode 100644 index 0000000..c789221 --- /dev/null +++ b/packages/fl_query/example/.flutter-plugins @@ -0,0 +1,6 @@ +# This is a generated file; do not edit or check into version control. +connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/ +connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/ +connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/ +connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.3/ +connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/ diff --git a/packages/fl_query/example/.flutter-plugins-dependencies b/packages/fl_query/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..bd6638d --- /dev/null +++ b/packages/fl_query/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.3/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-08-07 10:27:39.110033","version":"3.0.1"} \ No newline at end of file diff --git a/packages/fl_query/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/packages/fl_query/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..47e95c9 --- /dev/null +++ b/packages/fl_query/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,24 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.connectivity.ConnectivityPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin connectivity_plus, dev.fluttercommunity.plus.connectivity.ConnectivityPlugin", e); + } + } +} diff --git a/packages/fl_query/example/android/gradle/wrapper/gradle-wrapper.jar b/packages/fl_query/example/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/packages/fl_query/example/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/fl_query/example/android/gradlew b/packages/fl_query/example/android/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/packages/fl_query/example/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/packages/fl_query/example/android/gradlew.bat b/packages/fl_query/example/android/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/packages/fl_query/example/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/fl_query/example/android/local.properties b/packages/fl_query/example/android/local.properties new file mode 100644 index 0000000..dfe0f1d --- /dev/null +++ b/packages/fl_query/example/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=/opt/android-sdk +flutter.sdk=/opt/flutter \ No newline at end of file diff --git a/packages/fl_query/example/ios/Flutter/Generated.xcconfig b/packages/fl_query/example/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..0651718 --- /dev/null +++ b/packages/fl_query/example/ios/Flutter/Generated.xcconfig @@ -0,0 +1,13 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/opt/flutter +FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=lib/main.dart +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/packages/fl_query/example/ios/Flutter/flutter_export_environment.sh b/packages/fl_query/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..dc91195 --- /dev/null +++ b/packages/fl_query/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/opt/flutter" +export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example" +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" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.h b/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// 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 */ diff --git a/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.m b/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..a85d5ee --- /dev/null +++ b/packages/fl_query/example/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,21 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import connectivity_plus; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [ConnectivityPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"ConnectivityPlusPlugin"]]; +} + +@end diff --git a/packages/fl_query/example/lib/generated_plugin_registrant.dart b/packages/fl_query/example/lib/generated_plugin_registrant.dart new file mode 100644 index 0000000..533f170 --- /dev/null +++ b/packages/fl_query/example/lib/generated_plugin_registrant.dart @@ -0,0 +1,17 @@ +// +// Generated file. Do not edit. +// + +// ignore_for_file: directives_ordering +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: depend_on_referenced_packages + +import 'package:connectivity_plus_web/connectivity_plus_web.dart'; + +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +// ignore: public_member_api_docs +void registerPlugins(Registrar registrar) { + ConnectivityPlusPlugin.registerWith(registrar); + registrar.registerMessageHandler(); +} diff --git a/packages/fl_query/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux b/packages/fl_query/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux new file mode 120000 index 0000000..2b44726 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux @@ -0,0 +1 @@ +/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/ \ No newline at end of file diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h new file mode 100644 index 0000000..b9fec01 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h @@ -0,0 +1,205 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlBasicMessageChannel, + fl_basic_message_channel, + FL, + BASIC_MESSAGE_CHANNEL, + GObject) + +G_DECLARE_FINAL_TYPE(FlBasicMessageChannelResponseHandle, + fl_basic_message_channel_response_handle, + FL, + BASIC_MESSAGE_CHANNEL_RESPONSE_HANDLE, + GObject) + +/** + * FlBasicMessageChannel: + * + * #FlBasicMessageChannel is an object that allows sending and receiving + * messages to/from Dart code over platform channels. + * + * The following example shows how to send messages on a channel: + * + * |[ + * static FlBasicMessageChannel *channel = NULL; + * + * static void message_cb (FlBasicMessageChannel* channel, + * FlValue* message, + * FlBasicMessageChannelResponseHandle* response_handle, + * gpointer user_data) { + * g_autoptr(FlValue) response = handle_message (message); + * g_autoptr(GError) error = NULL; + * if (!fl_basic_message_channel_respond (channel, response_handle, response, + * &error)) + * g_warning ("Failed to send channel response: %s", error->message); + * } + * + * static void message_response_cb (GObject *object, + * GAsyncResult *result, + * gpointer user_data) { + * g_autoptr(GError) error = NULL; + * g_autoptr(FlValue) response = + * fl_basic_message_channel_send_finish (FL_BASIC_MESSAGE_CHANNEL (object), + * result, &error); + * if (response == NULL) { + * g_warning ("Failed to send message: %s", error->message); + * return; + * } + * + * handle_response (response); + * } + * + * static void setup_channel () { + * g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new (); + * channel = fl_basic_message_channel_new (messenger, "flutter/foo", + * FL_MESSAGE_CODEC (codec)); + * fl_basic_message_channel_set_message_handler (channel, message_cb, NULL, + * NULL); + * + * g_autoptr(FlValue) message = fl_value_new_string ("Hello World"); + * fl_basic_message_channel_send (channel, message, NULL, + * message_response_cb, NULL); + * } + * ]| + * + * #FlBasicMessageChannel matches the BasicMessageChannel class in the Flutter + * services library. + */ + +/** + * FlBasicMessageChannelResponseHandle: + * + * #FlBasicMessageChannelResponseHandle is an object used to send responses + * with. + */ + +/** + * FlBasicMessageChannelMessageHandler: + * @channel: an #FlBasicMessageChannel. + * @message: message received. + * @response_handle: a handle to respond to the message with. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when a message is received. Call + * fl_basic_message_channel_respond() to respond to this message. If the + * response is not occurring in this callback take a reference to + * @response_handle and release that once it has been responded to. Failing to + * respond before the last reference to @response_handle is dropped is a + * programming error. + */ +typedef void (*FlBasicMessageChannelMessageHandler)( + FlBasicMessageChannel* channel, + FlValue* message, + FlBasicMessageChannelResponseHandle* response_handle, + gpointer user_data); + +/** + * fl_basic_message_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the message codec. + * + * Creates a basic message channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlBasicMessageChannel. + */ +FlBasicMessageChannel* fl_basic_message_channel_new( + FlBinaryMessenger* messenger, + const gchar* name, + FlMessageCodec* codec); + +/** + * fl_basic_message_channel_set_message_handler: + * @channel: an #FlBasicMessageChannel. + * @handler: (allow-none): function to call when a message is received on this + * channel or %NULL to disable the handler. + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a message is received from the Dart side of the + * channel. See #FlBasicMessageChannelMessageHandler for details on how to + * respond to messages. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_basic_message_channel_set_message_handler( + FlBasicMessageChannel* channel, + FlBasicMessageChannelMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_basic_message_channel_respond: + * @channel: an #FlBasicMessageChannel. + * @response_handle: handle that was provided in a + * #FlBasicMessageChannelMessageHandler. + * @message: (allow-none): message response to send or %NULL for an empty + * response. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a message. + * + * Returns: %TRUE on success. + */ +gboolean fl_basic_message_channel_respond( + FlBasicMessageChannel* channel, + FlBasicMessageChannelResponseHandle* response_handle, + FlValue* message, + GError** error); + +/** + * fl_basic_message_channel_send: + * @channel: an #FlBasicMessageChannel. + * @message: message to send, must match what the #FlMessageCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the request is satisfied or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Asynchronously sends a message. + */ +void fl_basic_message_channel_send(FlBasicMessageChannel* channel, + FlValue* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_basic_message_channel_send_finish: + * @channel: an #FlBasicMessageChannel. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_basic_message_channel_send(). + * + * Returns: message response on success or %NULL on error. + */ +FlValue* fl_basic_message_channel_send_finish(FlBasicMessageChannel* channel, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h new file mode 100644 index 0000000..e7223d8 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h @@ -0,0 +1,45 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlBinaryCodec, + fl_binary_codec, + FL, + BINARY_CODEC, + FlMessageCodec) + +/** + * FlBinaryCodec: + * + * #FlBinaryCodec is an #FlMessageCodec that implements the Flutter binary + * message encoding. This only encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_UINT8_LIST, other types #FlValues will generate an error + * during encoding. + * + * #FlBinaryCodec matches the BinaryCodec class in the Flutter services + * library. + */ + +/** + * fl_binary_codec_new: + * + * Creates an #FlBinaryCodec. + * + * Returns: a new #FlBinaryCodec. + */ +FlBinaryCodec* fl_binary_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h new file mode 100644 index 0000000..84af654 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h @@ -0,0 +1,189 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS + +/** + * FlBinaryMessengerError: + * @FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED: unable to send response, this + * message has already been responded to. + * + * Errors for #FlBinaryMessenger objects to set on failures. + */ +#define FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark() + +typedef enum { + FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED, +} FlBinaryMessengerError; + +GQuark fl_binary_messenger_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_INTERFACE(FlBinaryMessenger, + fl_binary_messenger, + FL, + BINARY_MESSENGER, + GObject) + +G_DECLARE_DERIVABLE_TYPE(FlBinaryMessengerResponseHandle, + fl_binary_messenger_response_handle, + FL, + BINARY_MESSENGER_RESPONSE_HANDLE, + GObject) + +/** + * FlBinaryMessengerMessageHandler: + * @messenger: an #FlBinaryMessenger. + * @channel: channel message received on. + * @message: message content received from Dart. + * @response_handle: a handle to respond to the message with. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when platform messages are received. Call + * fl_binary_messenger_send_response() to respond to this message. If the + * response is not occurring in this callback take a reference to + * @response_handle and release that once it has been responded to. Failing to + * respond before the last reference to @response_handle is dropped is a + * programming error. + */ +typedef void (*FlBinaryMessengerMessageHandler)( + FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + FlBinaryMessengerResponseHandle* response_handle, + gpointer user_data); + +struct _FlBinaryMessengerInterface { + GTypeInterface parent_iface; + + void (*set_message_handler_on_channel)( + FlBinaryMessenger* messenger, + const gchar* channel, + FlBinaryMessengerMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + + gboolean (*send_response)(FlBinaryMessenger* messenger, + FlBinaryMessengerResponseHandle* response_handle, + GBytes* response, + GError** error); + + void (*send_on_channel)(FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GBytes* (*send_on_channel_finish)(FlBinaryMessenger* messenger, + GAsyncResult* result, + GError** error); +}; + +struct _FlBinaryMessengerResponseHandleClass { + GObjectClass parent_class; +}; + +/** + * FlBinaryMessenger: + * + * #FlBinaryMessenger is an object that allows sending and receiving of platform + * messages with an #FlEngine. + */ + +/** + * FlBinaryMessengerResponseHandle: + * + * #FlBinaryMessengerResponseHandle is an object used to send responses with. + */ + +/** + * fl_binary_messenger_set_platform_message_handler: + * @binary_messenger: an #FlBinaryMessenger. + * @channel: channel to listen on. + * @handler: (allow-none): function to call when a message is received on this + * channel or %NULL to disable a handler + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a platform message is received on the given + * channel. See #FlBinaryMessengerMessageHandler for details on how to respond + * to messages. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_binary_messenger_set_message_handler_on_channel( + FlBinaryMessenger* messenger, + const gchar* channel, + FlBinaryMessengerMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_binary_messenger_send_response: + * @binary_messenger: an #FlBinaryMessenger. + * @response_handle: handle that was provided in a + * #FlBinaryMessengerMessageHandler. + * @response: (allow-none): response to send or %NULL for an empty response. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a platform message. + * + * Returns: %TRUE on success. + */ +gboolean fl_binary_messenger_send_response( + FlBinaryMessenger* messenger, + FlBinaryMessengerResponseHandle* response_handle, + GBytes* response, + GError** error); + +/** + * fl_binary_messenger_send_on_channel: + * @binary_messenger: an #FlBinaryMessenger. + * @channel: channel to send to. + * @message: (allow-none): message buffer to send or %NULL for an empty message. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): a #GAsyncReadyCallback to call when the request is + * satisfied. + * @user_data: (closure): user data to pass to @callback. + * + * Asynchronously sends a platform message. + */ +void fl_binary_messenger_send_on_channel(FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_binary_messenger_send_on_channel_finish: + * @binary_messenger: an #FlBinaryMessenger. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_binary_messenger_send_on_channel(). + * + * Returns: (transfer full): message response on success or %NULL on error. + */ +GBytes* fl_binary_messenger_send_on_channel_finish(FlBinaryMessenger* messenger, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h new file mode 100644 index 0000000..1b56e24 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h @@ -0,0 +1,125 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ + +#include + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlDartProject, fl_dart_project, FL, DART_PROJECT, GObject) + +/** + * FlDartProject: + * + * #FlDartProject represents a Dart project. It is used to provide information + * about the application when creating an #FlView. + */ + +/** + * fl_dart_project_new: + * + * Creates a Flutter project for the currently running executable. The following + * data files are required relative to the location of the executable: + * - data/flutter_assets/ (as built by the Flutter tool). + * - data/icudtl.dat (provided as a resource by the Flutter tool). + * - lib/libapp.so (as built by the Flutter tool when in AOT mode). + * + * Returns: a new #FlDartProject. + */ +FlDartProject* fl_dart_project_new(); + +/** + * fl_dart_project_set_enable_mirrors: + * @project: an #FlDartProject. + * @enable_mirrors: %TRUE if the dart:mirrors library should be used. + * + * Sets if this Flutter project can use the dart:mirrors library. + * + * Deprecated: This function is temporary and will be removed in a future + * release. + */ +void fl_dart_project_set_enable_mirrors(FlDartProject* project, + gboolean enable_mirrors) G_DEPRECATED; + +/** + * fl_dart_project_get_enable_mirrors: + * @project: an #FlDartProject. + * + * Gets if this Flutter project can use the dart:mirrors library. + * + * Returns: %TRUE if the dart:mirrors library can be used. + * + * Deprecated: This function is temporary and will be removed in a future + * release. + */ +gboolean fl_dart_project_get_enable_mirrors(FlDartProject* project) + G_DEPRECATED; + +/** + * fl_dart_project_get_aot_library_path: + * @project: an #FlDartProject. + * + * Gets the path to the AOT library in the Flutter application. + * + * Returns: (type filename): an absolute file path, e.g. + * "/projects/my_dart_project/lib/libapp.so". + */ +const gchar* fl_dart_project_get_aot_library_path(FlDartProject* project); + +/** + * fl_dart_project_get_assets_path: + * @project: an #FlDartProject. + * + * Gets the path to the directory containing the assets used in the Flutter + * application. + * + * Returns: (type filename): an absolute directory path, e.g. + * "/projects/my_dart_project/data/flutter_assets". + */ +const gchar* fl_dart_project_get_assets_path(FlDartProject* project); + +/** + * fl_dart_project_get_icu_data_path: + * @project: an #FlDartProject. + * + * Gets the path to the ICU data file in the Flutter application. + * + * Returns: (type filename): an absolute file path, e.g. + * "/projects/my_dart_project/data/icudtl.dat". + */ +const gchar* fl_dart_project_get_icu_data_path(FlDartProject* project); + +/** + * fl_dart_project_set_dart_entrypoint_arguments: + * @project: an #FlDartProject. + * @argv: a pointer to a NULL-terminated array of C strings containing the + * command line arguments. + * + * Sets the command line arguments to be passed through to the Dart + * entrypoint function. + */ +void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject* project, + char** argv); + +/** + * fl_dart_project_get_dart_entrypoint_arguments: + * @project: an #FlDartProject. + * + * Gets the command line arguments to be passed through to the Dart entrypoint + * function. + * + * Returns: a NULL-terminated array of strings containing the command line + * arguments to be passed to the Dart entrypoint. + */ +gchar** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject* project); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h new file mode 100644 index 0000000..6740c0b --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_binary_messenger.h" +#include "fl_dart_project.h" +#include "fl_texture_registrar.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlEngine, fl_engine, FL, ENGINE, GObject) + +/** + * FlEngine: + * + * #FlEngine is an object that contains a running Flutter engine. + */ + +/** + * fl_engine_new_headless: + * @project: an #FlDartProject. + * + * Creates new Flutter engine running in headless mode. + * + * Returns: a new #FlEngine. + */ +FlEngine* fl_engine_new_headless(FlDartProject* project); + +/** + * fl_engine_get_binary_messenger: + * @engine: an #FlEngine. + * + * Gets the messenger to communicate with this engine. + * + * Returns: an #FlBinaryMessenger. + */ +FlBinaryMessenger* fl_engine_get_binary_messenger(FlEngine* engine); + +/** + * fl_engine_get_texture_registrar: + * @engine: an #FlEngine. + * + * Gets the texture registrar for registering textures. + * + * Returns: an #FlTextureRegistrar. + */ +FlTextureRegistrar* fl_engine_get_texture_registrar(FlEngine* engine); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h new file mode 100644 index 0000000..7141def --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h @@ -0,0 +1,187 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_method_channel.h" +#include "fl_method_response.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlEventChannel, + fl_event_channel, + FL, + EVENT_CHANNEL, + GObject) + +/** + * FlEventChannel: + * + * #FlEventChannel is an object that allows sending + * an events stream to Dart code over platform channels. + * + * The following example shows how to send events on a channel: + * + * |[ + * static FlEventChannel *channel = NULL; + * static gboolean send_events = FALSE; + * + * static void event_occurs_cb (FooEvent *event) { + * if (send_events) { + * g_autoptr(FlValue) message = foo_event_to_value (event); + * g_autoptr(GError) error = NULL; + * if (!fl_event_channel_send (channel, message, NULL, &error)) { + * g_warning ("Failed to send event: %s", error->message); + * } + * } + * } + * + * static FlMethodErrorResponse* listen_cb (FlEventChannel* channel, + * FlValue *args, + * gpointer user_data) { + * send_events = TRUE; + * return NULL; + * } + * + * static FlMethodErrorResponse* cancel_cb (GObject *object, + * FlValue *args, + * gpointer user_data) { + * send_events = FALSE; + * return NULL; + * } + * + * static void setup_channel () { + * g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new (); + * channel = fl_event_channel_new (messenger, "flutter/foo", + * FL_METHOD_CODEC (codec)); + * fl_event_channel_set_stream_handlers (channel, listen_cb, cancel_cb, + * NULL, NULL); + * } + * ]| + * + * #FlEventChannel matches the EventChannel class in the Flutter + * services library. + */ + +/** + * FlEventChannelHandler: + * @channel: an #FlEventChannel. + * @args: arguments passed from the Dart end of the channel. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when the stream is listened to or cancelled. + * + * Returns: (transfer full): an #FlMethodErrorResponse or %NULL if no error. + */ +typedef FlMethodErrorResponse* (*FlEventChannelHandler)(FlEventChannel* channel, + FlValue* args, + gpointer user_data); + +/** + * fl_event_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the message codec. + * + * Creates an event channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlEventChannel. + */ +FlEventChannel* fl_event_channel_new(FlBinaryMessenger* messenger, + const gchar* name, + FlMethodCodec* codec); + +/** + * fl_event_channel_set_stream_handlers: + * @channel: an #FlEventChannel. + * @listen_handler: (allow-none): function to call when the Dart side of the + * channel starts listening to the stream. + * @cancel_handler: (allow-none): function to call when the Dart side of the + * channel cancels their subscription to the stream. + * @user_data: (closure): user data to pass to @listen_handler and + * @cancel_handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the functions called when the Dart side requests the stream to start and + * finish. + * + * The handlers are removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_event_channel_set_stream_handlers(FlEventChannel* channel, + FlEventChannelHandler listen_handler, + FlEventChannelHandler cancel_handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_event_channel_send: + * @channel: an #FlEventChannel. + * @event: event to send, must match what the #FlMethodCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Sends an event on the channel. + * Events should only be sent once the channel is being listened to. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send(FlEventChannel* channel, + FlValue* event, + GCancellable* cancellable, + GError** error); + +/** + * fl_event_channel_send_error: + * @channel: an #FlEventChannel. + * @code: error code to send. + * @message: error message to send. + * @details: (allow-none): error details or %NULL. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Sends an error on the channel. + * Errors should only be sent once the channel is being listened to. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send_error(FlEventChannel* channel, + const gchar* code, + const gchar* message, + FlValue* details, + GCancellable* cancellable, + GError** error); + +/** + * fl_event_channel_send_end_of_stream: + * @channel: an #FlEventChannel. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Indicates the stream has completed. + * It is a programmer error to send any more events after calling this. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send_end_of_stream(FlEventChannel* channel, + GCancellable* cancellable, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h new file mode 100644 index 0000000..ddf6818 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h @@ -0,0 +1,96 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +/** + * FlJsonMessageCodecError: + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8: Message is not valid UTF-8. + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON: Message is not valid JSON. + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE: Invalid object key + * type. + * + * Errors for #FlJsonMessageCodec objects to set on failures. + */ +#define FL_JSON_MESSAGE_CODEC_ERROR fl_json_message_codec_error_quark() + +typedef enum { + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8, + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON, + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, +} FlJsonMessageCodecError; + +GQuark fl_json_message_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_FINAL_TYPE(FlJsonMessageCodec, + fl_json_message_codec, + FL, + JSON_CODEC, + FlMessageCodec) + +/** + * FlJsonMessageCodec: + * + * #FlJsonMessageCodec is an #FlMessageCodec that implements the encodes + * #FlValue to/from JSON. This codec encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_NULL, #FL_VALUE_TYPE_BOOL, #FL_VALUE_TYPE_INT, + * #FL_VALUE_TYPE_FLOAT, #FL_VALUE_TYPE_STRING, #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST, and #FL_VALUE_TYPE_MAP. + * + * #FlJsonMessageCodec matches the JSONMessageCodec class in the Flutter + * services library. + */ + +/** + * fl_json_message_codec_new: + * + * Creates an #FlJsonMessageCodec. + * + * Returns: a new #FlJsonMessageCodec. + */ +FlJsonMessageCodec* fl_json_message_codec_new(); + +/** + * fl_json_message_codec_encode: + * @codec: an #FlJsonMessageCodec. + * @value: value to encode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a value to a JSON string. + * + * Returns: a JSON representation of this value or %NULL on error. + */ +gchar* fl_json_message_codec_encode(FlJsonMessageCodec* codec, + FlValue* value, + GError** error); + +/** + * fl_json_message_codec_decode: + * @codec: an #FlJsonMessageCodec. + * @text: UTF-8 text in JSON format. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a value from a JSON string. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_json_message_codec_decode(FlJsonMessageCodec* codec, + const gchar* text, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h new file mode 100644 index 0000000..70ddf79 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_method_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlJsonMethodCodec, + fl_json_method_codec, + FL, + JSON_METHOD_CODEC, + FlMethodCodec) + +/** + * FlJsonMethodCodec: + * + * #FlJsonMessageCodec is an #FlMethodCodec that implements method calls using + * the Flutter JSON message encoding. It should be used with an + * #FlMethodChannel. + * + * #FlJsonMethodCodec matches the JSONMethodCodec class in the Flutter services + * library. + */ + +/** + * fl_json_method_codec_new: + * + * Creates an #FlJsonMethodCodec. + * + * Returns: a new #FlJsonMethodCodec. + */ +FlJsonMethodCodec* fl_json_method_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h new file mode 100644 index 0000000..b74aad2 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h @@ -0,0 +1,129 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_value.h" + +G_BEGIN_DECLS + +/** + * FlMessageCodecError: + * @FL_MESSAGE_CODEC_ERROR_FAILED: Codec failed due to an unspecified error. + * @FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA: Codec ran out of data reading a value. + * @FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA: Additional data encountered in + * message. + * @FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE: Codec encountered an unsupported + * #FlValue. + * + * Errors for #FlMessageCodec objects to set on failures. + */ +#define FL_MESSAGE_CODEC_ERROR fl_message_codec_error_quark() + +typedef enum { + FL_MESSAGE_CODEC_ERROR_FAILED, + FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, + FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA, + FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE, +} FlMessageCodecError; + +GQuark fl_message_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_DERIVABLE_TYPE(FlMessageCodec, + fl_message_codec, + FL, + MESSAGE_CODEC, + GObject) + +/** + * FlMessageCodec: + * + * #FlMessageCodec is a message encoding/decoding mechanism that operates on + * #FlValue objects. Both operations returns errors if the conversion fails. + * Such situations should be treated as programming errors. + * + * #FlMessageCodec matches the MethodCodec class in the Flutter services + * library. + */ + +struct _FlMessageCodecClass { + GObjectClass parent_class; + + /** + * FlMessageCodec::encode_message: + * @codec: A #FlMessageCodec. + * @message: message to encode or %NULL to encode the null value. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Virtual method to encode a message. A subclass must implement this method. + * If the subclass cannot handle the type of @message then it must generate a + * FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE error. + * + * Returns: a binary message or %NULL on error. + */ + GBytes* (*encode_message)(FlMessageCodec* codec, + FlValue* message, + GError** error); + + /** + * FlMessageCodec::decode_message: + * @codec: an #FlMessageCodec. + * @message: binary message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Virtual method to decode a message. A subclass must implement this method. + * If @message is too small then a #FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA error + * must be generated. If @message is too large then a + * #FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA error must be generated. + * + * Returns: an #FlValue or %NULL on error. + */ + FlValue* (*decode_message)(FlMessageCodec* codec, + GBytes* message, + GError** error); +}; + +/** + * fl_message_codec_encode_message: + * @codec: an #FlMessageCodec. + * @buffer: buffer to write to. + * @message: message to encode or %NULL to encode the null value. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a message into a binary representation. + * + * Returns: a binary encoded message or %NULL on error. + */ +GBytes* fl_message_codec_encode_message(FlMessageCodec* codec, + FlValue* message, + GError** error); + +/** + * fl_message_codec_decode_message: + * @codec: an #FlMessageCodec. + * @message: binary message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a message from a binary encoding. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_message_codec_decode_message(FlMessageCodec* codec, + GBytes* message, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h new file mode 100644 index 0000000..5a5ebc7 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h @@ -0,0 +1,115 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_method_response.h" +#include "fl_value.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMethodCall, fl_method_call, FL, METHOD_CALL, GObject) + +/** + * FlMethodCall: + * + * #FlMethodCall represents and incoming method call as returned by an + * #FlMethodChannel. + */ + +/** + * fl_method_call_get_name: + * @method_call: an #FlMethodCall. + * + * Gets the name of the method call. + * + * Returns: a method name. + */ +const gchar* fl_method_call_get_name(FlMethodCall* method_call); + +/** + * fl_method_call_get_args: + * @method_call: an #FlMethodCall. + * + * Gets the arguments passed to the method. + * + * Returns: an #FlValue. + */ +FlValue* fl_method_call_get_args(FlMethodCall* method_call); + +/** + * fl_method_call_respond: + * @method_call: an #FlMethodCall. + * @response: an #FlMethodResponse. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a method call. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond(FlMethodCall* method_call, + FlMethodResponse* response, + GError** error); + +/** + * fl_method_call_respond_success: + * @method_call: an #FlMethodCall. + * @result: (allow-none): value to respond with, must match what the + * #FlMethodCodec supports. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with + * #FlMethodSuccessResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_success(FlMethodCall* method_call, + FlValue* result, + GError** error); + +/** + * fl_method_call_respond_error: + * @method_call: an #FlMethodCall. + * @code: error code. + * @message: (allow-none): error message. + * @details: (allow-none): details for the error. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with #FlMethodErrorResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_error(FlMethodCall* method_call, + const gchar* code, + const gchar* message, + FlValue* details, + GError** error); + +/** + * fl_method_call_respond_not_implemented: + * @method_call: an #FlMethodCall. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with + * #FlMethodNotImplementedResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_not_implemented(FlMethodCall* method_call, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h new file mode 100644 index 0000000..f4102ed --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h @@ -0,0 +1,190 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_method_call.h" +#include "fl_method_codec.h" +#include "fl_method_response.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMethodChannel, + fl_method_channel, + FL, + METHOD_CHANNEL, + GObject) + +/** + * FlMethodChannel: + * + * #FlMethodChannel is an object that allows method calls to and from Dart code. + * + * The following example shows how to call and handle methods on a channel. + * See #FlMethodResponse for how to handle errors in more detail. + * + * |[ + * static FlMethodChannel *channel = NULL; + * + * static void method_call_cb (FlMethodChannel* channel, + * FlMethodCall* method_call, + * gpointer user_data) { + * g_autoptr(FlMethodResponse) response = NULL; + * if (strcmp (fl_method_call_get_name (method_call), "Foo.bar") == 0) { + * g_autoptr(GError) bar_error = NULL; + * g_autoptr(FlValue) result = + * do_bar (fl_method_call_get_args (method_call), &bar_error); + * if (result == NULL) + * response = + * FL_METHOD_RESPONSE (fl_method_error_response_new ("bar error", + * bar_error->message)); + * else + * response = FL_METHOD_RESPONSE (fl_method_success_response_new + * (result)); } else response = FL_METHOD_RESPONSE + * (fl_method_not_implemented_response_new ()); + * + * g_autoptr(GError) error = NULL; + * if (!fl_method_call_respond(method_call, response)) + * g_warning ("Failed to send response: %s", error->message); + * } + * + * static void method_response_cb(GObject *object, + * GAsyncResult *result, + * gpointer user_data) { + * g_autoptr(GError) error = NULL; + * g_autoptr(FlMethodResponse) response = + * fl_method_channel_invoke_method_finish (FL_METHOD_CODEC (object), result, + * &error); + * if (response == NULL) { + * g_warning ("Failed to call method: %s", error->message); + * return; + * } + * + * g_autoptr(FlValue) value = + * fl_method_response_get_result (response, &error); + * if (response == NULL) { + * g_warning ("Method returned error: %s", error->message); + * return; + * } + * + * use_result (value); + * } + * + * static void call_method () { + * g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new (); + * channel = + * fl_method_channel_new(messenger, "flutter/foo", FL_METHOD_CODEC (codec)); + * fl_method_channel_set_method_call_handler (channel, method_call_cb, NULL, + * NULL); + * + * g_autoptr(FlValue) args = fl_value_new_string ("Hello World"); + * fl_method_channel_invoke_method (channel, "Foo.foo", args, + * cancellable, method_response_cb, NULL); + * } + * ]| + * + * #FlMethodChannel matches the MethodChannel class in the Flutter services + * library. + */ + +/** + * FlMethodChannelMethodCallHandler: + * @channel: an #FlMethodChannel. + * @method_call: an #FlMethodCall. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when a method call is received. Respond to the method call + * with fl_method_call_respond(). If the response is not occurring in this + * callback take a reference to @method_call and release that once it has been + * responded to. Failing to respond before the last reference to @method_call is + * dropped is a programming error. + */ +typedef void (*FlMethodChannelMethodCallHandler)(FlMethodChannel* channel, + FlMethodCall* method_call, + gpointer user_data); + +/** + * fl_method_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the method codec. + * + * Creates a new method channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlMethodChannel. + */ +FlMethodChannel* fl_method_channel_new(FlBinaryMessenger* messenger, + const gchar* name, + FlMethodCodec* codec); + +/** + * fl_method_channel_set_method_call_handler: + * @channel: an #FlMethodChannel. + * @handler: function to call when a method call is received on this channel. + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a method call is received from the Dart side of + * the channel. See #FlMethodChannelMethodCallHandler for details on how to + * respond to method calls. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_method_channel_set_method_call_handler( + FlMethodChannel* channel, + FlMethodChannelMethodCallHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_method_channel_invoke_method: + * @channel: an #FlMethodChannel. + * @method: the method to call. + * @args: (allow-none): arguments to the method, must match what the + * #FlMethodCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the request is satisfied or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Calls a method on this channel. + */ +void fl_method_channel_invoke_method(FlMethodChannel* channel, + const gchar* method, + FlValue* args, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_method_channel_invoke_method_finish: + * @channel: an #FlMethodChannel. + * @result: #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_method_channel_invoke_method(). + * + * Returns: (transfer full): an #FlMethodResponse or %NULL on error. + */ +FlMethodResponse* fl_method_channel_invoke_method_finish( + FlMethodChannel* channel, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h new file mode 100644 index 0000000..97bf8e9 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h @@ -0,0 +1,131 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_method_response.h" +#include "fl_value.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlMethodCodec, + fl_method_codec, + FL, + METHOD_CODEC, + GObject) + +/** + * FlMethodCodec: + * + * #FlMethodCodec is an abstract class that encodes and decodes method calls on + * a platform channel. Override this class to implement an encoding. + * + * #FlMethodCodec matches the MethodCodec class in the Flutter services + * library. + */ + +struct _FlMethodCodecClass { + GObjectClass parent_class; + + /** + * FlMethodCodec::encode_method_call: + * @codec: an #FlMethodCodec. + * @name: method name. + * @args: (allow-none): method arguments, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a method call. + * + * Returns: (transfer full): a binary encoding of this method call or %NULL if + * not able to encode. + */ + GBytes* (*encode_method_call)(FlMethodCodec* codec, + const gchar* name, + FlValue* args, + GError** error); + + /** + * FlMethodCodec::decode_method_call: + * @codec: an #FlMethodCodec + * @message: message to decode. + * @name: (transfer full): location to write method name or %NULL if not + * required + * @args: (transfer full): location to write method arguments, or %NULL if not + * required + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL + * + * Decodes a method call. + * + * Returns: %TRUE if successfully decoded. + */ + gboolean (*decode_method_call)(FlMethodCodec* codec, + GBytes* message, + gchar** name, + FlValue** args, + GError** error); + + /** + * FlMethodCodec::encode_success_envelope: + * @codec: an #FlMethodCodec. + * @result: (allow-none): method result, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a successful response to a method call. + * + * Returns: (transfer full): a binary encoding of this response or %NULL if + * not able to encode. + */ + GBytes* (*encode_success_envelope)(FlMethodCodec* codec, + FlValue* result, + GError** error); + + /** + * FlMethodCodec::encode_error_envelope: + * @codec: an #FlMethodCodec. + * @code: an error code. + * @message: (allow-none): an error message, or %NULL. + * @details: (allow-none): error details, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes an error response to a method call. + * + * Returns: (transfer full): a binary encoding of this response or %NULL if + * not able to encode. + */ + GBytes* (*encode_error_envelope)(FlMethodCodec* codec, + const gchar* code, + const gchar* message, + FlValue* details, + GError** error); + + /** + * FlMethodCodec::decode_response: + * @codec: an #FlMethodCodec. + * @message: message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a response to a method call. + * + * Returns: a new #FlMethodResponse or %NULL on error. + */ + FlMethodResponse* (*decode_response)(FlMethodCodec* codec, + GBytes* message, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h new file mode 100644 index 0000000..90c4b9c --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h @@ -0,0 +1,212 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_value.h" + +G_BEGIN_DECLS + +/** + * FlMethodResponseError: + * @FL_METHOD_RESPONSE_ERROR_FAILED: Call failed due to an unspecified error. + * @FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR: An error was returned by the other + * side of the channel. + * @FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED: The requested method is not + * implemented. + * + * Errors set by `fl_method_response_get_result` when the method call response + * is not #FlMethodSuccessResponse. + */ +#define FL_METHOD_RESPONSE_ERROR fl_method_response_error_quark() + +typedef enum { + FL_METHOD_RESPONSE_ERROR_FAILED, + FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR, + FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED, +} FlMethodResponseError; + +GQuark fl_method_response_error_quark(void) G_GNUC_CONST; + +G_DECLARE_DERIVABLE_TYPE(FlMethodResponse, + fl_method_response, + FL, + METHOD_RESPONSE, + GObject) + +struct _FlMethodResponseClass { + GObjectClass parent_class; +}; + +G_DECLARE_FINAL_TYPE(FlMethodSuccessResponse, + fl_method_success_response, + FL, + METHOD_SUCCESS_RESPONSE, + FlMethodResponse) + +G_DECLARE_FINAL_TYPE(FlMethodErrorResponse, + fl_method_error_response, + FL, + METHOD_ERROR_RESPONSE, + FlMethodResponse) + +G_DECLARE_FINAL_TYPE(FlMethodNotImplementedResponse, + fl_method_not_implemented_response, + FL, + METHOD_NOT_IMPLEMENTED_RESPONSE, + FlMethodResponse) + +/** + * FlMethodResponse: + * + * #FlMethodResponse contains the information returned when an #FlMethodChannel + * method call returns. If you expect the method call to be successful use + * fl_method_response_get_result(). If you want to handle error cases then you + * should use code like: + * + * |[ + * if (FL_IS_METHOD_SUCCESS_RESPONSE (response)) { + * FlValue *result = + * fl_method_success_response_get_result( + * FL_METHOD_SUCCESS_RESPONSE (response)); + * handle_result (result); + * } else if (FL_IS_METHOD_ERROR_RESPONSE (response)) { + * FlMethodErrorResponse *error_response = + * FL_METHOD_ERROR_RESPONSE (response); + * handle_error (fl_method_error_response_get_code (error_response), + * fl_method_error_response_get_message (error_response), + * fl_method_error_response_get_details (error_response)); + * } + * else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE (response)) { + * handle_not_implemented (); + * } + * } + * ]| + */ + +/** + * FlMethodSuccessResponse: + * + * #FlMethodSuccessResponse is the #FlMethodResponse returned when a method call + * has successfully completed. The result of the method call is obtained using + * `fl_method_success_response_get_result`. + */ + +/** + * FlMethodErrorResponse: + * + * #FlMethodErrorResponse is the #FlMethodResponse returned when a method call + * results in an error. The error details are obtained using + * `fl_method_error_response_get_code`, `fl_method_error_response_get_message` + * and `fl_method_error_response_get_details`. + */ + +/** + * FlMethodNotImplementedResponse: + * + * #FlMethodNotImplementedResponse is the #FlMethodResponse returned when a + * method call is not implemented. + */ + +/** + * fl_method_response_get_result: + * @response: an #FlMethodResponse. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Gets the result of a method call, or an error if the response wasn't + * successful. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_method_response_get_result(FlMethodResponse* response, + GError** error); + +/** + * fl_method_success_response_new: + * @result: (allow-none): the #FlValue returned by the method call or %NULL. + * + * Creates a response to a method call when that method has successfully + * completed. + * + * Returns: a new #FlMethodResponse. + */ +FlMethodSuccessResponse* fl_method_success_response_new(FlValue* result); + +/** + * fl_method_success_response_get_result: + * @response: an #FlMethodSuccessResponse. + * + * Gets the result of the method call. + * + * Returns: an #FlValue. + */ +FlValue* fl_method_success_response_get_result( + FlMethodSuccessResponse* response); + +/** + * fl_method_error_response_new: + * @result: an #FlValue. + * @code: an error code. + * @message: (allow-none): an error message. + * @details: (allow-none): error details. + * + * Creates a response to a method call when that method has returned an error. + * + * Returns: a new #FlMethodErrorResponse. + */ +FlMethodErrorResponse* fl_method_error_response_new(const gchar* code, + const gchar* message, + FlValue* details); + +/** + * fl_method_error_response_get_code: + * @response: an #FlMethodErrorResponse. + * + * Gets the error code reported. + * + * Returns: an error code. + */ +const gchar* fl_method_error_response_get_code(FlMethodErrorResponse* response); + +/** + * fl_method_error_response_get_message: + * @response: an #FlMethodErrorResponse. + * + * Gets the error message reported. + * + * Returns: an error message or %NULL if no error message provided. + */ +const gchar* fl_method_error_response_get_message( + FlMethodErrorResponse* response); + +/** + * fl_method_error_response_get_details: + * @response: an #FlMethodErrorResponse. + * + * Gets the details provided with this error. + * + * Returns: an #FlValue or %NULL if no details provided. + */ +FlValue* fl_method_error_response_get_details(FlMethodErrorResponse* response); + +/** + * fl_method_not_implemented_response_new: + * + * Creates a response to a method call when that method does not exist. + * + * Returns: a new #FlMethodNotImplementedResponse. + */ +FlMethodNotImplementedResponse* fl_method_not_implemented_response_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h new file mode 100644 index 0000000..adddd77 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h @@ -0,0 +1,107 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlPixelBufferTexture, + fl_pixel_buffer_texture, + FL, + PIXEL_BUFFER_TEXTURE, + GObject) + +/** + * FlPixelBufferTexture: + * + * #FlPixelBufferTexture represents an OpenGL texture generated from a pixel + * buffer. + * + * The following example shows how to implement an #FlPixelBufferTexture. + * ![ + * // Type definition, constructor, init, destructor and class_init are + * // omitted. + * struct _VideoPixelBufferTexture { // extends FlPixelBufferTexture + * FlPixelBufferTexture parent_instance; + * + * uint8_t *buffer; // your pixel buffer. + * } + * + * G_DEFINE_TYPE(VideoTexture, + * video_texture, + * fl_pixel_buffer_texture_get_type ()) + * + * static gboolean + * video_texture_copy_pixels (FlPixelBufferTexture* texture, + * const uint8_t** out_buffer, + * uint32_t* width, + * uint32_t* height, + * GError** error) { + * // This method is called on Render Thread. Be careful with your + * // cross-thread operation. + * + * // @width and @height are initially stored the canvas size in Flutter. + * + * // You must prepare your pixel buffer in RGBA format. + * // So you may do some format conversion first if your original pixel + * // buffer is not in RGBA format. + * manage_your_pixel_buffer_here (); + * + * if (your_operations_are_successfully_finished) { + * // Directly return pointer to your pixel buffer here. + * // Flutter takes content of your pixel buffer after this function + * // is finished. So you must make the buffer live long enough until + * // next tick of Render Thread. + * // If it is hard to manage lifetime of your pixel buffer, you should + * // take look into #FlTextureGL. + * + * *out_buffer = buffer; + * *width = real_width_of_buffer; + * *height = real_height_of_buffer; + * return TRUE; + * } else { + * // set @error to report failure. + * return FALSE; + * } + * } + * ]| + */ + +struct _FlPixelBufferTextureClass { + GObjectClass parent_class; + + /** + * FlPixelBufferTexture::copy_pixels: + * @texture: an #FlPixelBufferTexture. + * @buffer: (out): pixel data. + * @width: (inout): width of the texture in pixels. + * @height: (inout): height of the texture in pixels. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL to ignore. + * + * Retrieve pixel buffer in RGBA format. + * + * As this method is usually invoked from the render thread, you must + * take care of proper synchronization. It also needs to be ensured that + * the returned buffer is not released prior to unregistering this texture. + * + * Returns: %TRUE on success. + */ + gboolean (*copy_pixels)(FlPixelBufferTexture* texture, + const uint8_t** buffer, + uint32_t* width, + uint32_t* height, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h new file mode 100644 index 0000000..6382804 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h @@ -0,0 +1,76 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_binary_messenger.h" +#include "fl_texture_registrar.h" +#include "fl_view.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlPluginRegistrar, + fl_plugin_registrar, + FL, + PLUGIN_REGISTRAR, + GObject) + +struct _FlPluginRegistrarInterface { + GTypeInterface parent_iface; + + FlBinaryMessenger* (*get_messenger)(FlPluginRegistrar* registrar); + + FlTextureRegistrar* (*get_texture_registrar)(FlPluginRegistrar* registrar); + + FlView* (*get_view)(FlPluginRegistrar* registrar); +}; + +/** + * FlPluginRegistrar: + * + * #FlPluginRegistrar is used when registering new plugins. + */ + +/** + * fl_plugin_registrar_get_messenger: + * @registrar: an #FlPluginRegistrar. + * + * Gets the messenger this plugin can communicate with. + * + * Returns: an #FlBinaryMessenger. + */ +FlBinaryMessenger* fl_plugin_registrar_get_messenger( + FlPluginRegistrar* registrar); + +/** + * fl_plugin_registrar_get_texture_registrar: + * @registrar: an #FlPluginRegistrar. + * + * Gets the texture registrar this plugin can communicate with. + * + * Returns: an #FlTextureRegistrar. + */ +FlTextureRegistrar* fl_plugin_registrar_get_texture_registrar( + FlPluginRegistrar* registrar); + +/** + * fl_plugin_registrar_get_view: + * @registrar: an #FlPluginRegistrar. + * + * Get the view that Flutter is rendering with. + * + * Returns: (allow-none): an #FlView or %NULL if running in headless mode. + */ +FlView* fl_plugin_registrar_get_view(FlPluginRegistrar* registrar); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h new file mode 100644 index 0000000..ac16aba --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_plugin_registrar.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlPluginRegistry, + fl_plugin_registry, + FL, + PLUGIN_REGISTRY, + GObject) + +/** + * FlPluginRegistry: + * + * #FlPluginRegistry vends #FlPluginRegistrar objects for named plugins. + */ + +struct _FlPluginRegistryInterface { + GTypeInterface g_iface; + + /** + * FlPluginRegistry::get_registrar_for_plugin: + * @registry: an #FlPluginRegistry. + * @name: plugin name. + * + * Gets the plugin registrar for the plugin with @name. + * + * Returns: (transfer full): an #FlPluginRegistrar. + */ + FlPluginRegistrar* (*get_registrar_for_plugin)(FlPluginRegistry* registry, + const gchar* name); +}; + +/** + * fl_plugin_registry_get_registrar_for_plugin: + * @registry: an #FlPluginRegistry. + * @name: plugin name. + * + * Gets the plugin registrar for the plugin with @name. + * + * Returns: (transfer full): an #FlPluginRegistrar. + */ +FlPluginRegistrar* fl_plugin_registry_get_registrar_for_plugin( + FlPluginRegistry* registry, + const gchar* name); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h new file mode 100644 index 0000000..2af7b83 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h @@ -0,0 +1,47 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStandardMessageCodec, + fl_standard_message_codec, + FL, + STANDARD_CODEC, + FlMessageCodec) + +/** + * FlStandardMessageCodec: + * + * #FlStandardMessageCodec is an #FlMessageCodec that implements the Flutter + * standard message encoding. This codec encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_NULL, #FL_VALUE_TYPE_BOOL, #FL_VALUE_TYPE_INT, + * #FL_VALUE_TYPE_FLOAT, #FL_VALUE_TYPE_STRING, #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST, and #FL_VALUE_TYPE_MAP. + * + * #FlStandardMessageCodec matches the StandardCodec class in the Flutter + * services library. + */ + +/* + * fl_standard_message_codec_new: + * + * Creates an #FlStandardMessageCodec. + * + * Returns: a new #FlStandardMessageCodec. + */ +FlStandardMessageCodec* fl_standard_message_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h new file mode 100644 index 0000000..1685ebc --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_method_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStandardMethodCodec, + fl_standard_method_codec, + FL, + STANDARD_METHOD_CODEC, + FlMethodCodec) + +/** + * FlStandardMethodCodec: + * + * #FlStandardMethodCodec is an #FlMethodCodec that implements method calls + * using the Flutter standard message encoding. It should be used with a + * #FlMethodChannel. + * + * #FlStandardMethodCodec matches the StandardMethodCodec class in the Flutter + * services library. + */ + +/** + * fl_standard_method_codec_new: + * + * Creates an #FlStandardMethodCodec. + * + * Returns: a new #FlStandardMethodCodec. + */ +FlStandardMethodCodec* fl_standard_method_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h new file mode 100644 index 0000000..8f49e9f --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStringCodec, + fl_string_codec, + FL, + STRING_CODEC, + FlMessageCodec) + +/** + * FlStringCodec: + * + * #FlStringCodec is an #FlMessageCodec that implements the Flutter string + * message encoding. This only encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_STRING, other types #FlValues will generate an error during + * encoding. + * + * #FlStringCodec matches the StringCodec class in the Flutter services library. + */ + +/** + * fl_string_codec_new: + * + * Creates an #FlStringCodec. + * + * Returns: a new #FlStringCodec. + */ +FlStringCodec* fl_string_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h new file mode 100644 index 0000000..45ceb51 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlTexture, fl_texture, FL, TEXTURE, GObject) + +/** + * FlTexture: + * + * #FlTexture represents a texture. + * + * You can derive #FlTextureGL for populating hardware-accelerated textures or + * instantiate #FlPixelBufferTexture for populating pixel buffers. Do NOT + * directly implement this interface. + */ + +struct _FlTextureInterface { + GTypeInterface g_iface; +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h new file mode 100644 index 0000000..949f4af --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h @@ -0,0 +1,103 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_GL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_GL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlTextureGL, fl_texture_gl, FL, TEXTURE_GL, GObject) + +/** + * FlTextureGL: + * + * #FlTextureGL is an abstract class that represents an OpenGL texture. + * + * If you want to render textures in other OpenGL context, create and use the + * #GdkGLContext by calling gdk_window_create_gl_context () with the #GdkWindow + * of #FlView. The context will be shared with the one used by Flutter. + * + * The following example shows how to implement an #FlTextureGL. + * ![ + * #include + * + * // Type definition, constructor, init, destructor, and class_init are + * // omitted. + * struct _VideoTextureGL { // extends FlTextureGL + * FlTextureGL parent_instance; + * + * GLuint texture_id; + * }; + * + * G_DEFINE_TYPE(VideoTexture, + * video_texture, + * fl_texture_gl_get_type ()) + * + * static gboolean + * video_texture_populate (FlTextureGL *texture, + * uint32_t *target, + * uint32_t *name, + * uint32_t *width, + * uint32_t *height, + * GError **error) { + * VideoTextureGL *self = VIDEO_TEXTURE_GL (texture); + * if (self->texture_id == 0) { + * glGenTextures (1, &self->texture_id); + * glBindTexture (GL_TEXTURE_2D, self->texture_id); + * // further configuration here. + * } else { + * glBindTexture (GL_TEXTURE_2D, self->texture_id); + * } + * + * // For example, we render pixel buffer here. + * // Note that Flutter only accepts textures in GL_RGBA8 format. + * static char buffer[] = { 0x1f, 0x2f, 0x3f, 0x4f }; // 1x1 pixel. + * glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, + * GL_UNSIGNED_BYTE, buffer); + * + * *target = GL_TEXTURE_2D; + * *name = self->texture_id; + * *width = 1; + * *height = 1; + * + * return TRUE; + * } + * ]| + */ + +struct _FlTextureGLClass { + GObjectClass parent_class; + + /** + * Virtual method called when Flutter populates this texture. The OpenGL + * context used by Flutter has been already set. + * @texture: an #FlTexture. + * @target: texture target (example GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE). + * @name: (out): name of texture. + * @width: (inout): width of the texture in pixels. + * @height: (inout): height of the texture in pixels. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL to ignore. + * + * Returns: %TRUE on success. + */ + gboolean (*populate)(FlTextureGL* texture, + uint32_t* target, + uint32_t* name, + uint32_t* width, + uint32_t* height, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h new file mode 100644 index 0000000..1c03cdc --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h @@ -0,0 +1,91 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlTextureRegistrar, + fl_texture_registrar, + FL, + TEXTURE_REGISTRAR, + GObject) + +struct _FlTextureRegistrarInterface { + GTypeInterface parent_iface; + + gboolean (*register_texture)(FlTextureRegistrar* registrar, + FlTexture* texture); + + FlTexture* (*lookup_texture)(FlTextureRegistrar* registrar, int64_t id); + + gboolean (*mark_texture_frame_available)(FlTextureRegistrar* registrar, + FlTexture* texture); + + gboolean (*unregister_texture)(FlTextureRegistrar* registrar, + FlTexture* texture); +}; + +/** + * FlTextureRegistrar: + * + * #FlTextureRegistrar is used when registering textures. + * + * Flutter Framework accesses your texture by the related unique texture ID. To + * draw your texture in Dart, you should add Texture widget in your widget tree + * with the same texture ID. Use platform channels to send this unique texture + * ID to the Dart side. + */ + +/** + * fl_texture_registrar_register_texture: + * @registrar: an #FlTextureRegistrar. + * @texture: an #FlTexture for registration. + * + * Registers a texture. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_register_texture(FlTextureRegistrar* registrar, + FlTexture* texture); + +/** + * fl_texture_registrar_mark_texture_frame_available: + * @registrar: an #FlTextureRegistrar. + * @texture: the texture that has a frame available. + * + * Notifies the flutter engine that the texture object has updated and needs to + * be rerendered. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_mark_texture_frame_available( + FlTextureRegistrar* registrar, + FlTexture* texture); + +/** + * fl_texture_registrar_unregister_texture: + * @registrar: an #FlTextureRegistrar. + * @texture: the texture being unregistered. + * + * Unregisters an existing texture object. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar* registrar, + FlTexture* texture); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_value.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_value.h new file mode 100644 index 0000000..7365d46 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_value.h @@ -0,0 +1,614 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ + +#include +#include +#include + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +/** + * FlValue: + * + * #FlValue is an object that contains the data types used in the platform + * channel used by Flutter. + * + * In Dart the values are represented as follows: + * - #FL_VALUE_TYPE_NULL: Null + * - #FL_VALUE_TYPE_BOOL: bool + * - #FL_VALUE_TYPE_INT: num + * - #FL_VALUE_TYPE_FLOAT: num + * - #FL_VALUE_TYPE_STRING: String + * - #FL_VALUE_TYPE_UINT8_LIST: Uint8List + * - #FL_VALUE_TYPE_INT32_LIST: Int32List + * - #FL_VALUE_TYPE_INT64_LIST: Int64List + * - #FL_VALUE_TYPE_FLOAT32_LIST: Float32List + * - #FL_VALUE_TYPE_FLOAT_LIST: Float64List + * - #FL_VALUE_TYPE_LIST: List + * - #FL_VALUE_TYPE_MAP: Map + * + * See #FlMessageCodec to encode and decode these values. + */ +typedef struct _FlValue FlValue; + +/** + * FlValueType: + * @FL_VALUE_TYPE_NULL: The null value. + * @FL_VALUE_TYPE_BOOL: A boolean. + * @FL_VALUE_TYPE_INT: A 64 bit signed integer. + * @FL_VALUE_TYPE_FLOAT: A 64 bit floating point number. + * @FL_VALUE_TYPE_STRING: UTF-8 text. + * @FL_VALUE_TYPE_UINT8_LIST: An ordered list of unsigned 8 bit integers. + * @FL_VALUE_TYPE_INT32_LIST: An ordered list of 32 bit integers. + * @FL_VALUE_TYPE_INT64_LIST: An ordered list of 64 bit integers. + * @FL_VALUE_TYPE_FLOAT_LIST: An ordered list of floating point numbers. + * @FL_VALUE_TYPE_LIST: An ordered list of #FlValue objects. + * @FL_VALUE_TYPE_MAP: A map of #FlValue objects keyed by #FlValue object. + * @FL_VALUE_TYPE_FLOAT32_LIST: An ordered list of 32bit floating point numbers. + * + * Types of #FlValue. + */ +typedef enum { + FL_VALUE_TYPE_NULL, + FL_VALUE_TYPE_BOOL, + FL_VALUE_TYPE_INT, + FL_VALUE_TYPE_FLOAT, + FL_VALUE_TYPE_STRING, + FL_VALUE_TYPE_UINT8_LIST, + FL_VALUE_TYPE_INT32_LIST, + FL_VALUE_TYPE_INT64_LIST, + FL_VALUE_TYPE_FLOAT_LIST, + FL_VALUE_TYPE_LIST, + FL_VALUE_TYPE_MAP, + FL_VALUE_TYPE_FLOAT32_LIST, +} FlValueType; + +/** + * fl_value_new_null: + * + * Creates an #FlValue that contains a null value. The equivalent Dart type is + * null. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_null(); + +/** + * fl_value_new_bool: + * @value: the value. + * + * Creates an #FlValue that contains a boolean value. The equivalent Dart type + * is a bool. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_bool(bool value); + +/** + * fl_value_new_int: + * @value: the value. + * + * Creates an #FlValue that contains an integer number. The equivalent Dart type + * is a num. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int(int64_t value); + +/** + * fl_value_new_float: + * @value: the value. + * + * Creates an #FlValue that contains a floating point number. The equivalent + * Dart type is a num. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float(double value); + +/** + * fl_value_new_string: + * @value: a %NULL-terminated UTF-8 string. + * + * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a + * String. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_string(const gchar* value); + +/** + * fl_value_new_string_sized: + * @value: a buffer containing UTF-8 text. It does not require a nul terminator. + * @value_length: the number of bytes to use from @value. + * + * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a + * String. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_string_sized(const gchar* value, size_t value_length); + +/** + * fl_value_new_uint8_list: + * @value: an array of unsigned 8 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 8 bit unsigned integers. The data is + * copied. The equivalent Dart type is a Uint8List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_uint8_list(const uint8_t* value, size_t value_length); + +/** + * fl_value_new_uint8_list_from_bytes: + * @value: a #GBytes. + * + * Creates an ordered list containing 8 bit unsigned integers. The data is + * copied. The equivalent Dart type is a Uint8List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_uint8_list_from_bytes(GBytes* value); + +/** + * fl_value_new_int32_list: + * @value: an array of signed 32 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 32 bit integers. The equivalent Dart type + * is a Int32List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int32_list(const int32_t* value, size_t value_length); + +/** + * fl_value_new_int64_list: + * @value: an array of signed 64 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 64 bit integers. The equivalent Dart type + * is a Int64List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int64_list(const int64_t* value, size_t value_length); + +/** + * fl_value_new_float32_list: + * @value: an array of floating point numbers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 32 bit floating point numbers. + * The equivalent Dart type is a Float32List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float32_list(const float* value, size_t value_length); + +/** + * fl_value_new_float_list: + * @value: an array of floating point numbers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing floating point numbers. The equivalent + * Dart type is a Float64List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float_list(const double* value, size_t value_length); + +/** + * fl_value_new_list: + * + * Creates an ordered list. Children can be added to the list using + * fl_value_append(). The children are accessed using fl_value_get_length() + * and fl_value_get_list_value(). The equivalent Dart type is a List. + * + * The following example shows a simple list of values: + * + * |[ + * g_autoptr(FlValue) value = fl_value_new_list (); + * fl_value_append_take (value, fl_value_new_string ("one"); + * fl_value_append_take (value, fl_value_new_int (2); + * fl_value_append_take (value, fl_value_new_double (3.0); + * ]| + * + * This value can be decoded using: + * + * |[ + * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_LIST); + * for (size_t i = 0; i < fl_value_get_length (value); i++) { + * FlValue *child = fl_value_get_list_value (value, i); + * process_value (child); + * } + * ]| + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_list(); + +/** + * fl_value_new_list_from_strv: + * @value: a %NULL-terminated array of strings. + * + * Creates an ordered list containing #FlString values. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_list_from_strv(const gchar* const* value); + +/** + * fl_value_new_map: + * + * Creates an ordered associative array. Children can be added to the map + * using fl_value_set(), fl_value_set_take(), fl_value_set_string(), + * fl_value_set_string_take(). The children are accessed using + * fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), + * fl_value_lookup() and fl_value_lookup_string(). The equivalent Dart type is a + * Map. + * + * The following example shows how to create a map of values keyed by strings: + * + * |[ + * g_autoptr(FlValue) value = fl_value_new_map (); + * fl_value_set_string_take (value, "name", fl_value_new_string ("Gandalf")); + * fl_value_set_string_take (value, "occupation", + * fl_value_new_string ("Wizard")); + * fl_value_set_string_take (value, "age", fl_value_new_int (2019)); + * ]| + * + * This value can be decoded using: + * |[ + * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_MAP); + * FlValue *name = fl_value_lookup_string (value, "name"); + * g_assert (fl_value_get_type (name) == FL_VALUE_TYPE_STRING); + * FlValue *age = fl_value_lookup_string (value, "age"); + * g_assert (fl_value_get_type (age) == FL_VALUE_TYPE_INT); + * g_message ("Next customer is %s (%d years old)", + * fl_value_get_string (name), + * fl_value_get_int (age)); + * ]| + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_map(); + +/** + * fl_value_ref: + * @value: an #FlValue. + * + * Increases the reference count of an #FlValue. + * + * Returns: the value that was referenced. + */ +FlValue* fl_value_ref(FlValue* value); + +/** + * fl_value_unref: + * @value: an #FlValue. + * + * Decreases the reference count of an #FlValue. When the reference count hits + * zero @value is destroyed and no longer valid. + */ +void fl_value_unref(FlValue* value); + +/** + * fl_value_get_type: + * @value: an #FlValue. + * + * Gets the type of @value. + * + * Returns: an #FlValueType. + */ +FlValueType fl_value_get_type(FlValue* value); + +/** + * fl_value_equal: + * @a: an #FlValue. + * @b: an #FlValue. + * + * Compares two #FlValue to see if they are equivalent. Two values are + * considered equivalent if they are of the same type and their data is the same + * including any child values. For values of type #FL_VALUE_TYPE_MAP the order + * of the values does not matter. + * + * Returns: %TRUE if both values are equivalent. + */ +bool fl_value_equal(FlValue* a, FlValue* b); + +/** + * fl_value_append: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @child: an #FlValue. + * + * Adds @child to the end of @value. Calling this with an #FlValue that is not + * of type #FL_VALUE_TYPE_LIST is a programming error. + */ +void fl_value_append(FlValue* value, FlValue* child); + +/** + * fl_value_append_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @child: (transfer full): an #FlValue. + * + * Adds @child to the end of @value. Ownership of @child is taken by @value. + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_LIST is a + * programming error. + */ +void fl_value_append_take(FlValue* value, FlValue* child); + +/** + * fl_value_set: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: an #FlValue. + * @child_value: an #FlValue. + * + * Sets @key in @value to @child_value. If an existing value was in the map with + * the same key it is replaced. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set(FlValue* value, FlValue* key, FlValue* child_value); + +/** + * fl_value_set_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: (transfer full): an #FlValue. + * @child_value: (transfer full): an #FlValue. + * + * Sets @key in @value to @child_value. Ownership of both @key and @child_value + * is taken by @value. If an existing value was in the map with the same key it + * is replaced. Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set_take(FlValue* value, FlValue* key, FlValue* child_value); + +/** + * fl_value_set_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a UTF-8 text key. + * @child_value: an #FlValue. + * + * Sets a value in the map with a text key. If an existing value was in the map + * with the same key it is replaced. Calling this with an #FlValue that is not + * of type #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set_string(FlValue* value, + const gchar* key, + FlValue* child_value); + +/** + * fl_value_set_string_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a UTF-8 text key. + * @child_value: (transfer full): an #FlValue. + * + * Sets a value in the map with a text key, taking ownership of the value. If an + * existing value was in the map with the same key it is replaced. Calling this + * with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a programming + * error. + */ +void fl_value_set_string_take(FlValue* value, + const gchar* key, + FlValue* child_value); + +/** + * fl_value_get_bool: + * @value: an #FlValue of type #FL_VALUE_TYPE_BOOL. + * + * Gets the boolean value of @value. Calling this with an #FlValue that is + * not of type #FL_VALUE_TYPE_BOOL is a programming error. + * + * Returns: a boolean value. + */ +bool fl_value_get_bool(FlValue* value); + +/** + * fl_value_get_int: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT. + * + * Gets the integer number of @value. Calling this with an #FlValue that is + * not of type #FL_VALUE_TYPE_INT is a programming error. + * + * Returns: an integer number. + */ +int64_t fl_value_get_int(FlValue* value); + +/** + * fl_value_get_float: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT. + * + * Gets the floating point number of @value. Calling this with an #FlValue + * that is not of type #FL_VALUE_TYPE_FLOAT is a programming error. + * + * Returns: a floating point number. + */ +double fl_value_get_float(FlValue* value); + +/** + * fl_value_get_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_STRING. + * + * Gets the UTF-8 text contained in @value. Calling this with an #FlValue + * that is not of type #FL_VALUE_TYPE_STRING is a programming error. + * + * Returns: a UTF-8 encoded string. + */ +const gchar* fl_value_get_string(FlValue* value); + +/** + * fl_value_get_length: + * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT32_LIST, #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST + * or #FL_VALUE_TYPE_MAP. + * + * Gets the number of elements @value contains. This is only valid for list + * and map types. Calling this with other types is a programming error. + * + * Returns: the number of elements inside @value. + */ +size_t fl_value_get_length(FlValue* value); + +/** + * fl_value_get_uint8_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST. + * + * Gets the array of unisigned 8 bit integers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_UINT8_LIST is a programming error. + * + * Returns: an array of unsigned 8 bit integers. + */ +const uint8_t* fl_value_get_uint8_list(FlValue* value); + +/** + * fl_value_get_int32_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT32_LIST. + * + * Gets the array of 32 bit integers @value contains. The data contains + * fl_value_get_length() elements. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_INT32_LIST is a programming error. + * + * Returns: an array of 32 bit integers. + */ +const int32_t* fl_value_get_int32_list(FlValue* value); + +/** + * fl_value_get_int64_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT64_LIST. + * + * Gets the array of 64 bit integers @value contains. The data contains + * fl_value_get_length() elements. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_INT64_LIST is a programming error. + * + * Returns: an array of 64 bit integers. + */ +const int64_t* fl_value_get_int64_list(FlValue* value); + +/** + * fl_value_get_float32_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT32_LIST. + * + * Gets the array of floating point numbers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_FLOAT32_LIST is a programming error. + * + * Returns: an array of floating point numbers. + */ +const float* fl_value_get_float32_list(FlValue* value); + +/** + * fl_value_get_float_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT_LIST. + * + * Gets the array of floating point numbers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_FLOAT_LIST is a programming error. + * + * Returns: an array of floating point numbers. + */ +const double* fl_value_get_float_list(FlValue* value); + +/** + * fl_value_get_list_value: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @index: an index in the list. + * + * Gets a child element of the list. It is a programming error to request an + * index that is outside the size of the list as returned from + * fl_value_get_length(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_LIST is a programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_list_value(FlValue* value, size_t index); + +/** + * fl_value_get_map_key: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @index: an index in the map. + * + * Gets a key from the map. It is a programming error to request an index that + * is outside the size of the list as returned from fl_value_get_length(). + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a + * programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_map_key(FlValue* value, size_t index); + +/** + * fl_value_get_map_value: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @index: an index in the map. + * + * Gets a value from the map. It is a programming error to request an index that + * is outside the size of the list as returned from fl_value_get_length(). + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a + * programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_map_value(FlValue* value, size_t index); + +/** + * fl_value_lookup: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a key value. + * + * Gets the map entry that matches @key. Keys are checked using + * fl_value_equal(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + * + * Map lookups are not optimized for performance - if you have a large map or + * need frequent access you should copy the data into another structure, e.g. + * #GHashTable. + * + * Returns: (allow-none): the value with this key or %NULL if not one present. + */ +FlValue* fl_value_lookup(FlValue* value, FlValue* key); + +/** + * fl_value_lookup_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a key value. + * + * Gets the map entry that matches @key. Keys are checked using + * fl_value_equal(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + * + * Map lookups are not optimized for performance - if you have a large map or + * need frequent access you should copy the data into another structure, e.g. + * #GHashTable. + * + * Returns: (allow-none): the value with this key or %NULL if not one present. + */ +FlValue* fl_value_lookup_string(FlValue* value, const gchar* key); + +/** + * fl_value_to_string: + * @value: an #FlValue. + * + * Converts an #FlValue to a text representation, suitable for logging purposes. + * The text is formatted to be the equivalent of Dart toString() methods. + * + * Returns: UTF-8 text. + */ +gchar* fl_value_to_string(FlValue* value); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(FlValue, fl_value_unref) + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_view.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_view.h new file mode 100644 index 0000000..f93f385 --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/fl_view.h @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_dart_project.h" +#include "fl_engine.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlView, fl_view, FL, VIEW, GtkContainer) + +/** + * FlView: + * + * #FlView is a GTK widget that is capable of displaying a Flutter application. + * + * The following example shows how to set up a view in a GTK application: + * |[ + * FlDartProject *project = fl_dart_project_new (); + * FlView *view = fl_view_new (project); + * gtk_widget_show (GTK_WIDGET (view)); + * gtk_container_add (GTK_CONTAINER (parent), view); + * + * FlBinaryMessenger *messenger = + * fl_engine_get_binary_messenger (fl_view_get_engine (view)); + * setup_channels_or_plugins (messenger); + * ]| + */ + +/** + * fl_view_new: + * @project: The project to show. + * + * Creates a widget to show Flutter application. + * + * Returns: a new #FlView. + */ +FlView* fl_view_new(FlDartProject* project); + +/** + * fl_view_get_engine: + * @view: an #FlView. + * + * Gets the engine being rendered in the view. + * + * Returns: an #FlEngine. + */ +FlEngine* fl_view_get_engine(FlView* view); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h new file mode 100644 index 0000000..2d9317d --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h @@ -0,0 +1,37 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ + +#define __FLUTTER_LINUX_INSIDE__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __FLUTTER_LINUX_INSIDE__ + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/generated_config.cmake b/packages/fl_query/example/linux/flutter/ephemeral/generated_config.cmake new file mode 100644 index 0000000..f848afc --- /dev/null +++ b/packages/fl_query/example/linux/flutter/ephemeral/generated_config.cmake @@ -0,0 +1,15 @@ +# Generated code do not commit. +file(TO_CMAKE_PATH "/opt/flutter" FLUTTER_ROOT) +file(TO_CMAKE_PATH "/home/krtirtho/dev/fl-query/packages/fl_query/example" PROJECT_DIR) + +# Environment variables to pass to tool_backend.sh +list(APPEND FLUTTER_TOOL_ENVIRONMENT + "FLUTTER_ROOT=/opt/flutter" + "PROJECT_DIR=/home/krtirtho/dev/fl-query/packages/fl_query/example" + "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" + "DART_OBFUSCATION=false" + "TRACK_WIDGET_CREATION=true" + "TREE_SHAKE_ICONS=false" + "PACKAGE_CONFIG=/home/krtirtho/dev/fl-query/packages/fl_query/example/.dart_tool/package_config.json" + "FLUTTER_TARGET=/home/krtirtho/dev/fl-query/packages/fl_query/example/lib/main.dart" +) diff --git a/packages/fl_query/example/linux/flutter/ephemeral/icudtl.dat b/packages/fl_query/example/linux/flutter/ephemeral/icudtl.dat new file mode 100644 index 0000000..d733c28 Binary files /dev/null and b/packages/fl_query/example/linux/flutter/ephemeral/icudtl.dat differ diff --git a/packages/fl_query/example/linux/flutter/ephemeral/libflutter_linux_gtk.so b/packages/fl_query/example/linux/flutter/ephemeral/libflutter_linux_gtk.so new file mode 100644 index 0000000..5511cd0 Binary files /dev/null and b/packages/fl_query/example/linux/flutter/ephemeral/libflutter_linux_gtk.so differ diff --git a/packages/fl_query/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/packages/fl_query/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..f9db3c7 --- /dev/null +++ b/packages/fl_query/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/opt/flutter +FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/packages/fl_query/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/packages/fl_query/example/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100755 index 0000000..430e089 --- /dev/null +++ b/packages/fl_query/example/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/opt/flutter" +export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/packages/fl_query/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows b/packages/fl_query/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows new file mode 120000 index 0000000..6e3df44 --- /dev/null +++ b/packages/fl_query/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows @@ -0,0 +1 @@ +/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/ \ No newline at end of file diff --git a/packages/fl_query_hooks/example/.flutter-plugins b/packages/fl_query_hooks/example/.flutter-plugins new file mode 100644 index 0000000..c789221 --- /dev/null +++ b/packages/fl_query_hooks/example/.flutter-plugins @@ -0,0 +1,6 @@ +# This is a generated file; do not edit or check into version control. +connectivity_plus=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/ +connectivity_plus_linux=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/ +connectivity_plus_macos=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/ +connectivity_plus_web=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.3/ +connectivity_plus_windows=/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/ diff --git a/packages/fl_query_hooks/example/.flutter-plugins-dependencies b/packages/fl_query_hooks/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..7cdcd7c --- /dev/null +++ b/packages/fl_query_hooks/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/","native_build":true,"dependencies":[]}],"android":[{"name":"connectivity_plus","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus-2.3.6/","native_build":true,"dependencies":[]}],"macos":[{"name":"connectivity_plus_macos","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_macos-1.2.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"connectivity_plus_linux","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"connectivity_plus_windows","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/","native_build":true,"dependencies":[]}],"web":[{"name":"connectivity_plus_web","path":"/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_web-1.2.3/","dependencies":[]}]},"dependencyGraph":[{"name":"connectivity_plus","dependencies":["connectivity_plus_linux","connectivity_plus_macos","connectivity_plus_web","connectivity_plus_windows"]},{"name":"connectivity_plus_linux","dependencies":[]},{"name":"connectivity_plus_macos","dependencies":[]},{"name":"connectivity_plus_web","dependencies":[]},{"name":"connectivity_plus_windows","dependencies":[]}],"date_created":"2022-08-07 10:52:09.828374","version":"3.0.1"} \ No newline at end of file diff --git a/packages/fl_query_hooks/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/packages/fl_query_hooks/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..47e95c9 --- /dev/null +++ b/packages/fl_query_hooks/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,24 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.connectivity.ConnectivityPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin connectivity_plus, dev.fluttercommunity.plus.connectivity.ConnectivityPlugin", e); + } + } +} diff --git a/packages/fl_query_hooks/example/android/gradle/wrapper/gradle-wrapper.jar b/packages/fl_query_hooks/example/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/packages/fl_query_hooks/example/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/packages/fl_query_hooks/example/android/gradlew b/packages/fl_query_hooks/example/android/gradlew new file mode 100755 index 0000000..9d82f78 --- /dev/null +++ b/packages/fl_query_hooks/example/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/packages/fl_query_hooks/example/android/gradlew.bat b/packages/fl_query_hooks/example/android/gradlew.bat new file mode 100644 index 0000000..aec9973 --- /dev/null +++ b/packages/fl_query_hooks/example/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/packages/fl_query_hooks/example/android/local.properties b/packages/fl_query_hooks/example/android/local.properties new file mode 100644 index 0000000..dfe0f1d --- /dev/null +++ b/packages/fl_query_hooks/example/android/local.properties @@ -0,0 +1,2 @@ +sdk.dir=/opt/android-sdk +flutter.sdk=/opt/flutter \ No newline at end of file diff --git a/packages/fl_query_hooks/example/ios/Flutter/Generated.xcconfig b/packages/fl_query_hooks/example/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..2188029 --- /dev/null +++ b/packages/fl_query_hooks/example/ios/Flutter/Generated.xcconfig @@ -0,0 +1,13 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/opt/flutter +FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=lib/main.dart +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/packages/fl_query_hooks/example/ios/Flutter/flutter_export_environment.sh b/packages/fl_query_hooks/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..6591be9 --- /dev/null +++ b/packages/fl_query_hooks/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/opt/flutter" +export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example" +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" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.h b/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.h new file mode 100644 index 0000000..7a89092 --- /dev/null +++ b/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.h @@ -0,0 +1,19 @@ +// +// 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 */ diff --git a/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.m b/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.m new file mode 100644 index 0000000..a85d5ee --- /dev/null +++ b/packages/fl_query_hooks/example/ios/Runner/GeneratedPluginRegistrant.m @@ -0,0 +1,21 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#import "GeneratedPluginRegistrant.h" + +#if __has_include() +#import +#else +@import connectivity_plus; +#endif + +@implementation GeneratedPluginRegistrant + ++ (void)registerWithRegistry:(NSObject*)registry { + [ConnectivityPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"ConnectivityPlusPlugin"]]; +} + +@end diff --git a/packages/fl_query_hooks/example/lib/generated_plugin_registrant.dart b/packages/fl_query_hooks/example/lib/generated_plugin_registrant.dart new file mode 100644 index 0000000..533f170 --- /dev/null +++ b/packages/fl_query_hooks/example/lib/generated_plugin_registrant.dart @@ -0,0 +1,17 @@ +// +// Generated file. Do not edit. +// + +// ignore_for_file: directives_ordering +// ignore_for_file: lines_longer_than_80_chars +// ignore_for_file: depend_on_referenced_packages + +import 'package:connectivity_plus_web/connectivity_plus_web.dart'; + +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +// ignore: public_member_api_docs +void registerPlugins(Registrar registrar) { + ConnectivityPlusPlugin.registerWith(registrar); + registrar.registerMessageHandler(); +} diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux b/packages/fl_query_hooks/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux new file mode 120000 index 0000000..2b44726 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/.plugin_symlinks/connectivity_plus_linux @@ -0,0 +1 @@ +/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_linux-1.3.1/ \ No newline at end of file diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h new file mode 100644 index 0000000..b9fec01 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h @@ -0,0 +1,205 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlBasicMessageChannel, + fl_basic_message_channel, + FL, + BASIC_MESSAGE_CHANNEL, + GObject) + +G_DECLARE_FINAL_TYPE(FlBasicMessageChannelResponseHandle, + fl_basic_message_channel_response_handle, + FL, + BASIC_MESSAGE_CHANNEL_RESPONSE_HANDLE, + GObject) + +/** + * FlBasicMessageChannel: + * + * #FlBasicMessageChannel is an object that allows sending and receiving + * messages to/from Dart code over platform channels. + * + * The following example shows how to send messages on a channel: + * + * |[ + * static FlBasicMessageChannel *channel = NULL; + * + * static void message_cb (FlBasicMessageChannel* channel, + * FlValue* message, + * FlBasicMessageChannelResponseHandle* response_handle, + * gpointer user_data) { + * g_autoptr(FlValue) response = handle_message (message); + * g_autoptr(GError) error = NULL; + * if (!fl_basic_message_channel_respond (channel, response_handle, response, + * &error)) + * g_warning ("Failed to send channel response: %s", error->message); + * } + * + * static void message_response_cb (GObject *object, + * GAsyncResult *result, + * gpointer user_data) { + * g_autoptr(GError) error = NULL; + * g_autoptr(FlValue) response = + * fl_basic_message_channel_send_finish (FL_BASIC_MESSAGE_CHANNEL (object), + * result, &error); + * if (response == NULL) { + * g_warning ("Failed to send message: %s", error->message); + * return; + * } + * + * handle_response (response); + * } + * + * static void setup_channel () { + * g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new (); + * channel = fl_basic_message_channel_new (messenger, "flutter/foo", + * FL_MESSAGE_CODEC (codec)); + * fl_basic_message_channel_set_message_handler (channel, message_cb, NULL, + * NULL); + * + * g_autoptr(FlValue) message = fl_value_new_string ("Hello World"); + * fl_basic_message_channel_send (channel, message, NULL, + * message_response_cb, NULL); + * } + * ]| + * + * #FlBasicMessageChannel matches the BasicMessageChannel class in the Flutter + * services library. + */ + +/** + * FlBasicMessageChannelResponseHandle: + * + * #FlBasicMessageChannelResponseHandle is an object used to send responses + * with. + */ + +/** + * FlBasicMessageChannelMessageHandler: + * @channel: an #FlBasicMessageChannel. + * @message: message received. + * @response_handle: a handle to respond to the message with. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when a message is received. Call + * fl_basic_message_channel_respond() to respond to this message. If the + * response is not occurring in this callback take a reference to + * @response_handle and release that once it has been responded to. Failing to + * respond before the last reference to @response_handle is dropped is a + * programming error. + */ +typedef void (*FlBasicMessageChannelMessageHandler)( + FlBasicMessageChannel* channel, + FlValue* message, + FlBasicMessageChannelResponseHandle* response_handle, + gpointer user_data); + +/** + * fl_basic_message_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the message codec. + * + * Creates a basic message channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlBasicMessageChannel. + */ +FlBasicMessageChannel* fl_basic_message_channel_new( + FlBinaryMessenger* messenger, + const gchar* name, + FlMessageCodec* codec); + +/** + * fl_basic_message_channel_set_message_handler: + * @channel: an #FlBasicMessageChannel. + * @handler: (allow-none): function to call when a message is received on this + * channel or %NULL to disable the handler. + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a message is received from the Dart side of the + * channel. See #FlBasicMessageChannelMessageHandler for details on how to + * respond to messages. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_basic_message_channel_set_message_handler( + FlBasicMessageChannel* channel, + FlBasicMessageChannelMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_basic_message_channel_respond: + * @channel: an #FlBasicMessageChannel. + * @response_handle: handle that was provided in a + * #FlBasicMessageChannelMessageHandler. + * @message: (allow-none): message response to send or %NULL for an empty + * response. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a message. + * + * Returns: %TRUE on success. + */ +gboolean fl_basic_message_channel_respond( + FlBasicMessageChannel* channel, + FlBasicMessageChannelResponseHandle* response_handle, + FlValue* message, + GError** error); + +/** + * fl_basic_message_channel_send: + * @channel: an #FlBasicMessageChannel. + * @message: message to send, must match what the #FlMessageCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the request is satisfied or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Asynchronously sends a message. + */ +void fl_basic_message_channel_send(FlBasicMessageChannel* channel, + FlValue* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_basic_message_channel_send_finish: + * @channel: an #FlBasicMessageChannel. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_basic_message_channel_send(). + * + * Returns: message response on success or %NULL on error. + */ +FlValue* fl_basic_message_channel_send_finish(FlBasicMessageChannel* channel, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BASIC_MESSAGE_CHANNEL_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h new file mode 100644 index 0000000..e7223d8 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h @@ -0,0 +1,45 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlBinaryCodec, + fl_binary_codec, + FL, + BINARY_CODEC, + FlMessageCodec) + +/** + * FlBinaryCodec: + * + * #FlBinaryCodec is an #FlMessageCodec that implements the Flutter binary + * message encoding. This only encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_UINT8_LIST, other types #FlValues will generate an error + * during encoding. + * + * #FlBinaryCodec matches the BinaryCodec class in the Flutter services + * library. + */ + +/** + * fl_binary_codec_new: + * + * Creates an #FlBinaryCodec. + * + * Returns: a new #FlBinaryCodec. + */ +FlBinaryCodec* fl_binary_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h new file mode 100644 index 0000000..84af654 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h @@ -0,0 +1,189 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS + +/** + * FlBinaryMessengerError: + * @FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED: unable to send response, this + * message has already been responded to. + * + * Errors for #FlBinaryMessenger objects to set on failures. + */ +#define FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark() + +typedef enum { + FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED, +} FlBinaryMessengerError; + +GQuark fl_binary_messenger_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_INTERFACE(FlBinaryMessenger, + fl_binary_messenger, + FL, + BINARY_MESSENGER, + GObject) + +G_DECLARE_DERIVABLE_TYPE(FlBinaryMessengerResponseHandle, + fl_binary_messenger_response_handle, + FL, + BINARY_MESSENGER_RESPONSE_HANDLE, + GObject) + +/** + * FlBinaryMessengerMessageHandler: + * @messenger: an #FlBinaryMessenger. + * @channel: channel message received on. + * @message: message content received from Dart. + * @response_handle: a handle to respond to the message with. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when platform messages are received. Call + * fl_binary_messenger_send_response() to respond to this message. If the + * response is not occurring in this callback take a reference to + * @response_handle and release that once it has been responded to. Failing to + * respond before the last reference to @response_handle is dropped is a + * programming error. + */ +typedef void (*FlBinaryMessengerMessageHandler)( + FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + FlBinaryMessengerResponseHandle* response_handle, + gpointer user_data); + +struct _FlBinaryMessengerInterface { + GTypeInterface parent_iface; + + void (*set_message_handler_on_channel)( + FlBinaryMessenger* messenger, + const gchar* channel, + FlBinaryMessengerMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + + gboolean (*send_response)(FlBinaryMessenger* messenger, + FlBinaryMessengerResponseHandle* response_handle, + GBytes* response, + GError** error); + + void (*send_on_channel)(FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GBytes* (*send_on_channel_finish)(FlBinaryMessenger* messenger, + GAsyncResult* result, + GError** error); +}; + +struct _FlBinaryMessengerResponseHandleClass { + GObjectClass parent_class; +}; + +/** + * FlBinaryMessenger: + * + * #FlBinaryMessenger is an object that allows sending and receiving of platform + * messages with an #FlEngine. + */ + +/** + * FlBinaryMessengerResponseHandle: + * + * #FlBinaryMessengerResponseHandle is an object used to send responses with. + */ + +/** + * fl_binary_messenger_set_platform_message_handler: + * @binary_messenger: an #FlBinaryMessenger. + * @channel: channel to listen on. + * @handler: (allow-none): function to call when a message is received on this + * channel or %NULL to disable a handler + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a platform message is received on the given + * channel. See #FlBinaryMessengerMessageHandler for details on how to respond + * to messages. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_binary_messenger_set_message_handler_on_channel( + FlBinaryMessenger* messenger, + const gchar* channel, + FlBinaryMessengerMessageHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_binary_messenger_send_response: + * @binary_messenger: an #FlBinaryMessenger. + * @response_handle: handle that was provided in a + * #FlBinaryMessengerMessageHandler. + * @response: (allow-none): response to send or %NULL for an empty response. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a platform message. + * + * Returns: %TRUE on success. + */ +gboolean fl_binary_messenger_send_response( + FlBinaryMessenger* messenger, + FlBinaryMessengerResponseHandle* response_handle, + GBytes* response, + GError** error); + +/** + * fl_binary_messenger_send_on_channel: + * @binary_messenger: an #FlBinaryMessenger. + * @channel: channel to send to. + * @message: (allow-none): message buffer to send or %NULL for an empty message. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): a #GAsyncReadyCallback to call when the request is + * satisfied. + * @user_data: (closure): user data to pass to @callback. + * + * Asynchronously sends a platform message. + */ +void fl_binary_messenger_send_on_channel(FlBinaryMessenger* messenger, + const gchar* channel, + GBytes* message, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_binary_messenger_send_on_channel_finish: + * @binary_messenger: an #FlBinaryMessenger. + * @result: a #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_binary_messenger_send_on_channel(). + * + * Returns: (transfer full): message response on success or %NULL on error. + */ +GBytes* fl_binary_messenger_send_on_channel_finish(FlBinaryMessenger* messenger, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_BINARY_MESSENGER_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h new file mode 100644 index 0000000..1b56e24 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h @@ -0,0 +1,125 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ + +#include + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlDartProject, fl_dart_project, FL, DART_PROJECT, GObject) + +/** + * FlDartProject: + * + * #FlDartProject represents a Dart project. It is used to provide information + * about the application when creating an #FlView. + */ + +/** + * fl_dart_project_new: + * + * Creates a Flutter project for the currently running executable. The following + * data files are required relative to the location of the executable: + * - data/flutter_assets/ (as built by the Flutter tool). + * - data/icudtl.dat (provided as a resource by the Flutter tool). + * - lib/libapp.so (as built by the Flutter tool when in AOT mode). + * + * Returns: a new #FlDartProject. + */ +FlDartProject* fl_dart_project_new(); + +/** + * fl_dart_project_set_enable_mirrors: + * @project: an #FlDartProject. + * @enable_mirrors: %TRUE if the dart:mirrors library should be used. + * + * Sets if this Flutter project can use the dart:mirrors library. + * + * Deprecated: This function is temporary and will be removed in a future + * release. + */ +void fl_dart_project_set_enable_mirrors(FlDartProject* project, + gboolean enable_mirrors) G_DEPRECATED; + +/** + * fl_dart_project_get_enable_mirrors: + * @project: an #FlDartProject. + * + * Gets if this Flutter project can use the dart:mirrors library. + * + * Returns: %TRUE if the dart:mirrors library can be used. + * + * Deprecated: This function is temporary and will be removed in a future + * release. + */ +gboolean fl_dart_project_get_enable_mirrors(FlDartProject* project) + G_DEPRECATED; + +/** + * fl_dart_project_get_aot_library_path: + * @project: an #FlDartProject. + * + * Gets the path to the AOT library in the Flutter application. + * + * Returns: (type filename): an absolute file path, e.g. + * "/projects/my_dart_project/lib/libapp.so". + */ +const gchar* fl_dart_project_get_aot_library_path(FlDartProject* project); + +/** + * fl_dart_project_get_assets_path: + * @project: an #FlDartProject. + * + * Gets the path to the directory containing the assets used in the Flutter + * application. + * + * Returns: (type filename): an absolute directory path, e.g. + * "/projects/my_dart_project/data/flutter_assets". + */ +const gchar* fl_dart_project_get_assets_path(FlDartProject* project); + +/** + * fl_dart_project_get_icu_data_path: + * @project: an #FlDartProject. + * + * Gets the path to the ICU data file in the Flutter application. + * + * Returns: (type filename): an absolute file path, e.g. + * "/projects/my_dart_project/data/icudtl.dat". + */ +const gchar* fl_dart_project_get_icu_data_path(FlDartProject* project); + +/** + * fl_dart_project_set_dart_entrypoint_arguments: + * @project: an #FlDartProject. + * @argv: a pointer to a NULL-terminated array of C strings containing the + * command line arguments. + * + * Sets the command line arguments to be passed through to the Dart + * entrypoint function. + */ +void fl_dart_project_set_dart_entrypoint_arguments(FlDartProject* project, + char** argv); + +/** + * fl_dart_project_get_dart_entrypoint_arguments: + * @project: an #FlDartProject. + * + * Gets the command line arguments to be passed through to the Dart entrypoint + * function. + * + * Returns: a NULL-terminated array of strings containing the command line + * arguments to be passed to the Dart entrypoint. + */ +gchar** fl_dart_project_get_dart_entrypoint_arguments(FlDartProject* project); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_DART_PROJECT_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h new file mode 100644 index 0000000..6740c0b --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_engine.h @@ -0,0 +1,60 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_binary_messenger.h" +#include "fl_dart_project.h" +#include "fl_texture_registrar.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlEngine, fl_engine, FL, ENGINE, GObject) + +/** + * FlEngine: + * + * #FlEngine is an object that contains a running Flutter engine. + */ + +/** + * fl_engine_new_headless: + * @project: an #FlDartProject. + * + * Creates new Flutter engine running in headless mode. + * + * Returns: a new #FlEngine. + */ +FlEngine* fl_engine_new_headless(FlDartProject* project); + +/** + * fl_engine_get_binary_messenger: + * @engine: an #FlEngine. + * + * Gets the messenger to communicate with this engine. + * + * Returns: an #FlBinaryMessenger. + */ +FlBinaryMessenger* fl_engine_get_binary_messenger(FlEngine* engine); + +/** + * fl_engine_get_texture_registrar: + * @engine: an #FlEngine. + * + * Gets the texture registrar for registering textures. + * + * Returns: an #FlTextureRegistrar. + */ +FlTextureRegistrar* fl_engine_get_texture_registrar(FlEngine* engine); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_ENGINE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h new file mode 100644 index 0000000..7141def --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_event_channel.h @@ -0,0 +1,187 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_method_channel.h" +#include "fl_method_response.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlEventChannel, + fl_event_channel, + FL, + EVENT_CHANNEL, + GObject) + +/** + * FlEventChannel: + * + * #FlEventChannel is an object that allows sending + * an events stream to Dart code over platform channels. + * + * The following example shows how to send events on a channel: + * + * |[ + * static FlEventChannel *channel = NULL; + * static gboolean send_events = FALSE; + * + * static void event_occurs_cb (FooEvent *event) { + * if (send_events) { + * g_autoptr(FlValue) message = foo_event_to_value (event); + * g_autoptr(GError) error = NULL; + * if (!fl_event_channel_send (channel, message, NULL, &error)) { + * g_warning ("Failed to send event: %s", error->message); + * } + * } + * } + * + * static FlMethodErrorResponse* listen_cb (FlEventChannel* channel, + * FlValue *args, + * gpointer user_data) { + * send_events = TRUE; + * return NULL; + * } + * + * static FlMethodErrorResponse* cancel_cb (GObject *object, + * FlValue *args, + * gpointer user_data) { + * send_events = FALSE; + * return NULL; + * } + * + * static void setup_channel () { + * g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new (); + * channel = fl_event_channel_new (messenger, "flutter/foo", + * FL_METHOD_CODEC (codec)); + * fl_event_channel_set_stream_handlers (channel, listen_cb, cancel_cb, + * NULL, NULL); + * } + * ]| + * + * #FlEventChannel matches the EventChannel class in the Flutter + * services library. + */ + +/** + * FlEventChannelHandler: + * @channel: an #FlEventChannel. + * @args: arguments passed from the Dart end of the channel. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when the stream is listened to or cancelled. + * + * Returns: (transfer full): an #FlMethodErrorResponse or %NULL if no error. + */ +typedef FlMethodErrorResponse* (*FlEventChannelHandler)(FlEventChannel* channel, + FlValue* args, + gpointer user_data); + +/** + * fl_event_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the message codec. + * + * Creates an event channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlEventChannel. + */ +FlEventChannel* fl_event_channel_new(FlBinaryMessenger* messenger, + const gchar* name, + FlMethodCodec* codec); + +/** + * fl_event_channel_set_stream_handlers: + * @channel: an #FlEventChannel. + * @listen_handler: (allow-none): function to call when the Dart side of the + * channel starts listening to the stream. + * @cancel_handler: (allow-none): function to call when the Dart side of the + * channel cancels their subscription to the stream. + * @user_data: (closure): user data to pass to @listen_handler and + * @cancel_handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the functions called when the Dart side requests the stream to start and + * finish. + * + * The handlers are removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_event_channel_set_stream_handlers(FlEventChannel* channel, + FlEventChannelHandler listen_handler, + FlEventChannelHandler cancel_handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_event_channel_send: + * @channel: an #FlEventChannel. + * @event: event to send, must match what the #FlMethodCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Sends an event on the channel. + * Events should only be sent once the channel is being listened to. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send(FlEventChannel* channel, + FlValue* event, + GCancellable* cancellable, + GError** error); + +/** + * fl_event_channel_send_error: + * @channel: an #FlEventChannel. + * @code: error code to send. + * @message: error message to send. + * @details: (allow-none): error details or %NULL. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Sends an error on the channel. + * Errors should only be sent once the channel is being listened to. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send_error(FlEventChannel* channel, + const gchar* code, + const gchar* message, + FlValue* details, + GCancellable* cancellable, + GError** error); + +/** + * fl_event_channel_send_end_of_stream: + * @channel: an #FlEventChannel. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Indicates the stream has completed. + * It is a programmer error to send any more events after calling this. + * + * Returns: %TRUE if successful. + */ +gboolean fl_event_channel_send_end_of_stream(FlEventChannel* channel, + GCancellable* cancellable, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_EVENT_CHANNEL_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h new file mode 100644 index 0000000..ddf6818 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h @@ -0,0 +1,96 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +/** + * FlJsonMessageCodecError: + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8: Message is not valid UTF-8. + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON: Message is not valid JSON. + * @FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE: Invalid object key + * type. + * + * Errors for #FlJsonMessageCodec objects to set on failures. + */ +#define FL_JSON_MESSAGE_CODEC_ERROR fl_json_message_codec_error_quark() + +typedef enum { + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8, + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON, + FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, +} FlJsonMessageCodecError; + +GQuark fl_json_message_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_FINAL_TYPE(FlJsonMessageCodec, + fl_json_message_codec, + FL, + JSON_CODEC, + FlMessageCodec) + +/** + * FlJsonMessageCodec: + * + * #FlJsonMessageCodec is an #FlMessageCodec that implements the encodes + * #FlValue to/from JSON. This codec encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_NULL, #FL_VALUE_TYPE_BOOL, #FL_VALUE_TYPE_INT, + * #FL_VALUE_TYPE_FLOAT, #FL_VALUE_TYPE_STRING, #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST, and #FL_VALUE_TYPE_MAP. + * + * #FlJsonMessageCodec matches the JSONMessageCodec class in the Flutter + * services library. + */ + +/** + * fl_json_message_codec_new: + * + * Creates an #FlJsonMessageCodec. + * + * Returns: a new #FlJsonMessageCodec. + */ +FlJsonMessageCodec* fl_json_message_codec_new(); + +/** + * fl_json_message_codec_encode: + * @codec: an #FlJsonMessageCodec. + * @value: value to encode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a value to a JSON string. + * + * Returns: a JSON representation of this value or %NULL on error. + */ +gchar* fl_json_message_codec_encode(FlJsonMessageCodec* codec, + FlValue* value, + GError** error); + +/** + * fl_json_message_codec_decode: + * @codec: an #FlJsonMessageCodec. + * @text: UTF-8 text in JSON format. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a value from a JSON string. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_json_message_codec_decode(FlJsonMessageCodec* codec, + const gchar* text, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_MESSAGE_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h new file mode 100644 index 0000000..70ddf79 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_method_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlJsonMethodCodec, + fl_json_method_codec, + FL, + JSON_METHOD_CODEC, + FlMethodCodec) + +/** + * FlJsonMethodCodec: + * + * #FlJsonMessageCodec is an #FlMethodCodec that implements method calls using + * the Flutter JSON message encoding. It should be used with an + * #FlMethodChannel. + * + * #FlJsonMethodCodec matches the JSONMethodCodec class in the Flutter services + * library. + */ + +/** + * fl_json_method_codec_new: + * + * Creates an #FlJsonMethodCodec. + * + * Returns: a new #FlJsonMethodCodec. + */ +FlJsonMethodCodec* fl_json_method_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_JSON_METHOD_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h new file mode 100644 index 0000000..b74aad2 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h @@ -0,0 +1,129 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_value.h" + +G_BEGIN_DECLS + +/** + * FlMessageCodecError: + * @FL_MESSAGE_CODEC_ERROR_FAILED: Codec failed due to an unspecified error. + * @FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA: Codec ran out of data reading a value. + * @FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA: Additional data encountered in + * message. + * @FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE: Codec encountered an unsupported + * #FlValue. + * + * Errors for #FlMessageCodec objects to set on failures. + */ +#define FL_MESSAGE_CODEC_ERROR fl_message_codec_error_quark() + +typedef enum { + FL_MESSAGE_CODEC_ERROR_FAILED, + FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, + FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA, + FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE, +} FlMessageCodecError; + +GQuark fl_message_codec_error_quark(void) G_GNUC_CONST; + +G_DECLARE_DERIVABLE_TYPE(FlMessageCodec, + fl_message_codec, + FL, + MESSAGE_CODEC, + GObject) + +/** + * FlMessageCodec: + * + * #FlMessageCodec is a message encoding/decoding mechanism that operates on + * #FlValue objects. Both operations returns errors if the conversion fails. + * Such situations should be treated as programming errors. + * + * #FlMessageCodec matches the MethodCodec class in the Flutter services + * library. + */ + +struct _FlMessageCodecClass { + GObjectClass parent_class; + + /** + * FlMessageCodec::encode_message: + * @codec: A #FlMessageCodec. + * @message: message to encode or %NULL to encode the null value. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Virtual method to encode a message. A subclass must implement this method. + * If the subclass cannot handle the type of @message then it must generate a + * FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE error. + * + * Returns: a binary message or %NULL on error. + */ + GBytes* (*encode_message)(FlMessageCodec* codec, + FlValue* message, + GError** error); + + /** + * FlMessageCodec::decode_message: + * @codec: an #FlMessageCodec. + * @message: binary message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Virtual method to decode a message. A subclass must implement this method. + * If @message is too small then a #FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA error + * must be generated. If @message is too large then a + * #FL_MESSAGE_CODEC_ERROR_ADDITIONAL_DATA error must be generated. + * + * Returns: an #FlValue or %NULL on error. + */ + FlValue* (*decode_message)(FlMessageCodec* codec, + GBytes* message, + GError** error); +}; + +/** + * fl_message_codec_encode_message: + * @codec: an #FlMessageCodec. + * @buffer: buffer to write to. + * @message: message to encode or %NULL to encode the null value. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a message into a binary representation. + * + * Returns: a binary encoded message or %NULL on error. + */ +GBytes* fl_message_codec_encode_message(FlMessageCodec* codec, + FlValue* message, + GError** error); + +/** + * fl_message_codec_decode_message: + * @codec: an #FlMessageCodec. + * @message: binary message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a message from a binary encoding. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_message_codec_decode_message(FlMessageCodec* codec, + GBytes* message, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_MESSAGE_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h new file mode 100644 index 0000000..5a5ebc7 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_call.h @@ -0,0 +1,115 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_method_response.h" +#include "fl_value.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMethodCall, fl_method_call, FL, METHOD_CALL, GObject) + +/** + * FlMethodCall: + * + * #FlMethodCall represents and incoming method call as returned by an + * #FlMethodChannel. + */ + +/** + * fl_method_call_get_name: + * @method_call: an #FlMethodCall. + * + * Gets the name of the method call. + * + * Returns: a method name. + */ +const gchar* fl_method_call_get_name(FlMethodCall* method_call); + +/** + * fl_method_call_get_args: + * @method_call: an #FlMethodCall. + * + * Gets the arguments passed to the method. + * + * Returns: an #FlValue. + */ +FlValue* fl_method_call_get_args(FlMethodCall* method_call); + +/** + * fl_method_call_respond: + * @method_call: an #FlMethodCall. + * @response: an #FlMethodResponse. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Responds to a method call. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond(FlMethodCall* method_call, + FlMethodResponse* response, + GError** error); + +/** + * fl_method_call_respond_success: + * @method_call: an #FlMethodCall. + * @result: (allow-none): value to respond with, must match what the + * #FlMethodCodec supports. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with + * #FlMethodSuccessResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_success(FlMethodCall* method_call, + FlValue* result, + GError** error); + +/** + * fl_method_call_respond_error: + * @method_call: an #FlMethodCall. + * @code: error code. + * @message: (allow-none): error message. + * @details: (allow-none): details for the error. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with #FlMethodErrorResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_error(FlMethodCall* method_call, + const gchar* code, + const gchar* message, + FlValue* details, + GError** error); + +/** + * fl_method_call_respond_not_implemented: + * @method_call: an #FlMethodCall. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Convenience method that responds to method call with + * #FlMethodNotImplementedResponse. + * + * Returns: %TRUE on success. + */ +gboolean fl_method_call_respond_not_implemented(FlMethodCall* method_call, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CALL_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h new file mode 100644 index 0000000..f4102ed --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h @@ -0,0 +1,190 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_binary_messenger.h" +#include "fl_method_call.h" +#include "fl_method_codec.h" +#include "fl_method_response.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlMethodChannel, + fl_method_channel, + FL, + METHOD_CHANNEL, + GObject) + +/** + * FlMethodChannel: + * + * #FlMethodChannel is an object that allows method calls to and from Dart code. + * + * The following example shows how to call and handle methods on a channel. + * See #FlMethodResponse for how to handle errors in more detail. + * + * |[ + * static FlMethodChannel *channel = NULL; + * + * static void method_call_cb (FlMethodChannel* channel, + * FlMethodCall* method_call, + * gpointer user_data) { + * g_autoptr(FlMethodResponse) response = NULL; + * if (strcmp (fl_method_call_get_name (method_call), "Foo.bar") == 0) { + * g_autoptr(GError) bar_error = NULL; + * g_autoptr(FlValue) result = + * do_bar (fl_method_call_get_args (method_call), &bar_error); + * if (result == NULL) + * response = + * FL_METHOD_RESPONSE (fl_method_error_response_new ("bar error", + * bar_error->message)); + * else + * response = FL_METHOD_RESPONSE (fl_method_success_response_new + * (result)); } else response = FL_METHOD_RESPONSE + * (fl_method_not_implemented_response_new ()); + * + * g_autoptr(GError) error = NULL; + * if (!fl_method_call_respond(method_call, response)) + * g_warning ("Failed to send response: %s", error->message); + * } + * + * static void method_response_cb(GObject *object, + * GAsyncResult *result, + * gpointer user_data) { + * g_autoptr(GError) error = NULL; + * g_autoptr(FlMethodResponse) response = + * fl_method_channel_invoke_method_finish (FL_METHOD_CODEC (object), result, + * &error); + * if (response == NULL) { + * g_warning ("Failed to call method: %s", error->message); + * return; + * } + * + * g_autoptr(FlValue) value = + * fl_method_response_get_result (response, &error); + * if (response == NULL) { + * g_warning ("Method returned error: %s", error->message); + * return; + * } + * + * use_result (value); + * } + * + * static void call_method () { + * g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new (); + * channel = + * fl_method_channel_new(messenger, "flutter/foo", FL_METHOD_CODEC (codec)); + * fl_method_channel_set_method_call_handler (channel, method_call_cb, NULL, + * NULL); + * + * g_autoptr(FlValue) args = fl_value_new_string ("Hello World"); + * fl_method_channel_invoke_method (channel, "Foo.foo", args, + * cancellable, method_response_cb, NULL); + * } + * ]| + * + * #FlMethodChannel matches the MethodChannel class in the Flutter services + * library. + */ + +/** + * FlMethodChannelMethodCallHandler: + * @channel: an #FlMethodChannel. + * @method_call: an #FlMethodCall. + * @user_data: (closure): data provided when registering this handler. + * + * Function called when a method call is received. Respond to the method call + * with fl_method_call_respond(). If the response is not occurring in this + * callback take a reference to @method_call and release that once it has been + * responded to. Failing to respond before the last reference to @method_call is + * dropped is a programming error. + */ +typedef void (*FlMethodChannelMethodCallHandler)(FlMethodChannel* channel, + FlMethodCall* method_call, + gpointer user_data); + +/** + * fl_method_channel_new: + * @messenger: an #FlBinaryMessenger. + * @name: a channel name. + * @codec: the method codec. + * + * Creates a new method channel. @codec must match the codec used on the Dart + * end of the channel. + * + * Returns: a new #FlMethodChannel. + */ +FlMethodChannel* fl_method_channel_new(FlBinaryMessenger* messenger, + const gchar* name, + FlMethodCodec* codec); + +/** + * fl_method_channel_set_method_call_handler: + * @channel: an #FlMethodChannel. + * @handler: function to call when a method call is received on this channel. + * @user_data: (closure): user data to pass to @handler. + * @destroy_notify: (allow-none): a function which gets called to free + * @user_data, or %NULL. + * + * Sets the function called when a method call is received from the Dart side of + * the channel. See #FlMethodChannelMethodCallHandler for details on how to + * respond to method calls. + * + * The handler is removed if the channel is closed or is replaced by another + * handler, set @destroy_notify if you want to detect this. + */ +void fl_method_channel_set_method_call_handler( + FlMethodChannel* channel, + FlMethodChannelMethodCallHandler handler, + gpointer user_data, + GDestroyNotify destroy_notify); + +/** + * fl_method_channel_invoke_method: + * @channel: an #FlMethodChannel. + * @method: the method to call. + * @args: (allow-none): arguments to the method, must match what the + * #FlMethodCodec supports. + * @cancellable: (allow-none): a #GCancellable or %NULL. + * @callback: (scope async): (allow-none): a #GAsyncReadyCallback to call when + * the request is satisfied or %NULL to ignore the response. + * @user_data: (closure): user data to pass to @callback. + * + * Calls a method on this channel. + */ +void fl_method_channel_invoke_method(FlMethodChannel* channel, + const gchar* method, + FlValue* args, + GCancellable* cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +/** + * fl_method_channel_invoke_method_finish: + * @channel: an #FlMethodChannel. + * @result: #GAsyncResult. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Completes request started with fl_method_channel_invoke_method(). + * + * Returns: (transfer full): an #FlMethodResponse or %NULL on error. + */ +FlMethodResponse* fl_method_channel_invoke_method_finish( + FlMethodChannel* channel, + GAsyncResult* result, + GError** error); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CHANNEL_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h new file mode 100644 index 0000000..97bf8e9 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h @@ -0,0 +1,131 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_method_response.h" +#include "fl_value.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlMethodCodec, + fl_method_codec, + FL, + METHOD_CODEC, + GObject) + +/** + * FlMethodCodec: + * + * #FlMethodCodec is an abstract class that encodes and decodes method calls on + * a platform channel. Override this class to implement an encoding. + * + * #FlMethodCodec matches the MethodCodec class in the Flutter services + * library. + */ + +struct _FlMethodCodecClass { + GObjectClass parent_class; + + /** + * FlMethodCodec::encode_method_call: + * @codec: an #FlMethodCodec. + * @name: method name. + * @args: (allow-none): method arguments, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a method call. + * + * Returns: (transfer full): a binary encoding of this method call or %NULL if + * not able to encode. + */ + GBytes* (*encode_method_call)(FlMethodCodec* codec, + const gchar* name, + FlValue* args, + GError** error); + + /** + * FlMethodCodec::decode_method_call: + * @codec: an #FlMethodCodec + * @message: message to decode. + * @name: (transfer full): location to write method name or %NULL if not + * required + * @args: (transfer full): location to write method arguments, or %NULL if not + * required + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL + * + * Decodes a method call. + * + * Returns: %TRUE if successfully decoded. + */ + gboolean (*decode_method_call)(FlMethodCodec* codec, + GBytes* message, + gchar** name, + FlValue** args, + GError** error); + + /** + * FlMethodCodec::encode_success_envelope: + * @codec: an #FlMethodCodec. + * @result: (allow-none): method result, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes a successful response to a method call. + * + * Returns: (transfer full): a binary encoding of this response or %NULL if + * not able to encode. + */ + GBytes* (*encode_success_envelope)(FlMethodCodec* codec, + FlValue* result, + GError** error); + + /** + * FlMethodCodec::encode_error_envelope: + * @codec: an #FlMethodCodec. + * @code: an error code. + * @message: (allow-none): an error message, or %NULL. + * @details: (allow-none): error details, or %NULL. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Encodes an error response to a method call. + * + * Returns: (transfer full): a binary encoding of this response or %NULL if + * not able to encode. + */ + GBytes* (*encode_error_envelope)(FlMethodCodec* codec, + const gchar* code, + const gchar* message, + FlValue* details, + GError** error); + + /** + * FlMethodCodec::decode_response: + * @codec: an #FlMethodCodec. + * @message: message to decode. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL. + * + * Decodes a response to a method call. + * + * Returns: a new #FlMethodResponse or %NULL on error. + */ + FlMethodResponse* (*decode_response)(FlMethodCodec* codec, + GBytes* message, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h new file mode 100644 index 0000000..90c4b9c --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_method_response.h @@ -0,0 +1,212 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_value.h" + +G_BEGIN_DECLS + +/** + * FlMethodResponseError: + * @FL_METHOD_RESPONSE_ERROR_FAILED: Call failed due to an unspecified error. + * @FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR: An error was returned by the other + * side of the channel. + * @FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED: The requested method is not + * implemented. + * + * Errors set by `fl_method_response_get_result` when the method call response + * is not #FlMethodSuccessResponse. + */ +#define FL_METHOD_RESPONSE_ERROR fl_method_response_error_quark() + +typedef enum { + FL_METHOD_RESPONSE_ERROR_FAILED, + FL_METHOD_RESPONSE_ERROR_REMOTE_ERROR, + FL_METHOD_RESPONSE_ERROR_NOT_IMPLEMENTED, +} FlMethodResponseError; + +GQuark fl_method_response_error_quark(void) G_GNUC_CONST; + +G_DECLARE_DERIVABLE_TYPE(FlMethodResponse, + fl_method_response, + FL, + METHOD_RESPONSE, + GObject) + +struct _FlMethodResponseClass { + GObjectClass parent_class; +}; + +G_DECLARE_FINAL_TYPE(FlMethodSuccessResponse, + fl_method_success_response, + FL, + METHOD_SUCCESS_RESPONSE, + FlMethodResponse) + +G_DECLARE_FINAL_TYPE(FlMethodErrorResponse, + fl_method_error_response, + FL, + METHOD_ERROR_RESPONSE, + FlMethodResponse) + +G_DECLARE_FINAL_TYPE(FlMethodNotImplementedResponse, + fl_method_not_implemented_response, + FL, + METHOD_NOT_IMPLEMENTED_RESPONSE, + FlMethodResponse) + +/** + * FlMethodResponse: + * + * #FlMethodResponse contains the information returned when an #FlMethodChannel + * method call returns. If you expect the method call to be successful use + * fl_method_response_get_result(). If you want to handle error cases then you + * should use code like: + * + * |[ + * if (FL_IS_METHOD_SUCCESS_RESPONSE (response)) { + * FlValue *result = + * fl_method_success_response_get_result( + * FL_METHOD_SUCCESS_RESPONSE (response)); + * handle_result (result); + * } else if (FL_IS_METHOD_ERROR_RESPONSE (response)) { + * FlMethodErrorResponse *error_response = + * FL_METHOD_ERROR_RESPONSE (response); + * handle_error (fl_method_error_response_get_code (error_response), + * fl_method_error_response_get_message (error_response), + * fl_method_error_response_get_details (error_response)); + * } + * else if (FL_IS_METHOD_NOT_IMPLEMENTED_RESPONSE (response)) { + * handle_not_implemented (); + * } + * } + * ]| + */ + +/** + * FlMethodSuccessResponse: + * + * #FlMethodSuccessResponse is the #FlMethodResponse returned when a method call + * has successfully completed. The result of the method call is obtained using + * `fl_method_success_response_get_result`. + */ + +/** + * FlMethodErrorResponse: + * + * #FlMethodErrorResponse is the #FlMethodResponse returned when a method call + * results in an error. The error details are obtained using + * `fl_method_error_response_get_code`, `fl_method_error_response_get_message` + * and `fl_method_error_response_get_details`. + */ + +/** + * FlMethodNotImplementedResponse: + * + * #FlMethodNotImplementedResponse is the #FlMethodResponse returned when a + * method call is not implemented. + */ + +/** + * fl_method_response_get_result: + * @response: an #FlMethodResponse. + * @error: (allow-none): #GError location to store the error occurring, or %NULL + * to ignore. + * + * Gets the result of a method call, or an error if the response wasn't + * successful. + * + * Returns: an #FlValue or %NULL on error. + */ +FlValue* fl_method_response_get_result(FlMethodResponse* response, + GError** error); + +/** + * fl_method_success_response_new: + * @result: (allow-none): the #FlValue returned by the method call or %NULL. + * + * Creates a response to a method call when that method has successfully + * completed. + * + * Returns: a new #FlMethodResponse. + */ +FlMethodSuccessResponse* fl_method_success_response_new(FlValue* result); + +/** + * fl_method_success_response_get_result: + * @response: an #FlMethodSuccessResponse. + * + * Gets the result of the method call. + * + * Returns: an #FlValue. + */ +FlValue* fl_method_success_response_get_result( + FlMethodSuccessResponse* response); + +/** + * fl_method_error_response_new: + * @result: an #FlValue. + * @code: an error code. + * @message: (allow-none): an error message. + * @details: (allow-none): error details. + * + * Creates a response to a method call when that method has returned an error. + * + * Returns: a new #FlMethodErrorResponse. + */ +FlMethodErrorResponse* fl_method_error_response_new(const gchar* code, + const gchar* message, + FlValue* details); + +/** + * fl_method_error_response_get_code: + * @response: an #FlMethodErrorResponse. + * + * Gets the error code reported. + * + * Returns: an error code. + */ +const gchar* fl_method_error_response_get_code(FlMethodErrorResponse* response); + +/** + * fl_method_error_response_get_message: + * @response: an #FlMethodErrorResponse. + * + * Gets the error message reported. + * + * Returns: an error message or %NULL if no error message provided. + */ +const gchar* fl_method_error_response_get_message( + FlMethodErrorResponse* response); + +/** + * fl_method_error_response_get_details: + * @response: an #FlMethodErrorResponse. + * + * Gets the details provided with this error. + * + * Returns: an #FlValue or %NULL if no details provided. + */ +FlValue* fl_method_error_response_get_details(FlMethodErrorResponse* response); + +/** + * fl_method_not_implemented_response_new: + * + * Creates a response to a method call when that method does not exist. + * + * Returns: a new #FlMethodNotImplementedResponse. + */ +FlMethodNotImplementedResponse* fl_method_not_implemented_response_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_METHOD_RESPONSE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h new file mode 100644 index 0000000..adddd77 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_pixel_buffer_texture.h @@ -0,0 +1,107 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlPixelBufferTexture, + fl_pixel_buffer_texture, + FL, + PIXEL_BUFFER_TEXTURE, + GObject) + +/** + * FlPixelBufferTexture: + * + * #FlPixelBufferTexture represents an OpenGL texture generated from a pixel + * buffer. + * + * The following example shows how to implement an #FlPixelBufferTexture. + * ![ + * // Type definition, constructor, init, destructor and class_init are + * // omitted. + * struct _VideoPixelBufferTexture { // extends FlPixelBufferTexture + * FlPixelBufferTexture parent_instance; + * + * uint8_t *buffer; // your pixel buffer. + * } + * + * G_DEFINE_TYPE(VideoTexture, + * video_texture, + * fl_pixel_buffer_texture_get_type ()) + * + * static gboolean + * video_texture_copy_pixels (FlPixelBufferTexture* texture, + * const uint8_t** out_buffer, + * uint32_t* width, + * uint32_t* height, + * GError** error) { + * // This method is called on Render Thread. Be careful with your + * // cross-thread operation. + * + * // @width and @height are initially stored the canvas size in Flutter. + * + * // You must prepare your pixel buffer in RGBA format. + * // So you may do some format conversion first if your original pixel + * // buffer is not in RGBA format. + * manage_your_pixel_buffer_here (); + * + * if (your_operations_are_successfully_finished) { + * // Directly return pointer to your pixel buffer here. + * // Flutter takes content of your pixel buffer after this function + * // is finished. So you must make the buffer live long enough until + * // next tick of Render Thread. + * // If it is hard to manage lifetime of your pixel buffer, you should + * // take look into #FlTextureGL. + * + * *out_buffer = buffer; + * *width = real_width_of_buffer; + * *height = real_height_of_buffer; + * return TRUE; + * } else { + * // set @error to report failure. + * return FALSE; + * } + * } + * ]| + */ + +struct _FlPixelBufferTextureClass { + GObjectClass parent_class; + + /** + * FlPixelBufferTexture::copy_pixels: + * @texture: an #FlPixelBufferTexture. + * @buffer: (out): pixel data. + * @width: (inout): width of the texture in pixels. + * @height: (inout): height of the texture in pixels. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL to ignore. + * + * Retrieve pixel buffer in RGBA format. + * + * As this method is usually invoked from the render thread, you must + * take care of proper synchronization. It also needs to be ensured that + * the returned buffer is not released prior to unregistering this texture. + * + * Returns: %TRUE on success. + */ + gboolean (*copy_pixels)(FlPixelBufferTexture* texture, + const uint8_t** buffer, + uint32_t* width, + uint32_t* height, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PIXEL_BUFFER_TEXTURE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h new file mode 100644 index 0000000..6382804 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h @@ -0,0 +1,76 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_binary_messenger.h" +#include "fl_texture_registrar.h" +#include "fl_view.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlPluginRegistrar, + fl_plugin_registrar, + FL, + PLUGIN_REGISTRAR, + GObject) + +struct _FlPluginRegistrarInterface { + GTypeInterface parent_iface; + + FlBinaryMessenger* (*get_messenger)(FlPluginRegistrar* registrar); + + FlTextureRegistrar* (*get_texture_registrar)(FlPluginRegistrar* registrar); + + FlView* (*get_view)(FlPluginRegistrar* registrar); +}; + +/** + * FlPluginRegistrar: + * + * #FlPluginRegistrar is used when registering new plugins. + */ + +/** + * fl_plugin_registrar_get_messenger: + * @registrar: an #FlPluginRegistrar. + * + * Gets the messenger this plugin can communicate with. + * + * Returns: an #FlBinaryMessenger. + */ +FlBinaryMessenger* fl_plugin_registrar_get_messenger( + FlPluginRegistrar* registrar); + +/** + * fl_plugin_registrar_get_texture_registrar: + * @registrar: an #FlPluginRegistrar. + * + * Gets the texture registrar this plugin can communicate with. + * + * Returns: an #FlTextureRegistrar. + */ +FlTextureRegistrar* fl_plugin_registrar_get_texture_registrar( + FlPluginRegistrar* registrar); + +/** + * fl_plugin_registrar_get_view: + * @registrar: an #FlPluginRegistrar. + * + * Get the view that Flutter is rendering with. + * + * Returns: (allow-none): an #FlView or %NULL if running in headless mode. + */ +FlView* fl_plugin_registrar_get_view(FlPluginRegistrar* registrar); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRAR_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h new file mode 100644 index 0000000..ac16aba --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_plugin_registrar.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlPluginRegistry, + fl_plugin_registry, + FL, + PLUGIN_REGISTRY, + GObject) + +/** + * FlPluginRegistry: + * + * #FlPluginRegistry vends #FlPluginRegistrar objects for named plugins. + */ + +struct _FlPluginRegistryInterface { + GTypeInterface g_iface; + + /** + * FlPluginRegistry::get_registrar_for_plugin: + * @registry: an #FlPluginRegistry. + * @name: plugin name. + * + * Gets the plugin registrar for the plugin with @name. + * + * Returns: (transfer full): an #FlPluginRegistrar. + */ + FlPluginRegistrar* (*get_registrar_for_plugin)(FlPluginRegistry* registry, + const gchar* name); +}; + +/** + * fl_plugin_registry_get_registrar_for_plugin: + * @registry: an #FlPluginRegistry. + * @name: plugin name. + * + * Gets the plugin registrar for the plugin with @name. + * + * Returns: (transfer full): an #FlPluginRegistrar. + */ +FlPluginRegistrar* fl_plugin_registry_get_registrar_for_plugin( + FlPluginRegistry* registry, + const gchar* name); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_PLUGIN_REGISTRY_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h new file mode 100644 index 0000000..2af7b83 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h @@ -0,0 +1,47 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStandardMessageCodec, + fl_standard_message_codec, + FL, + STANDARD_CODEC, + FlMessageCodec) + +/** + * FlStandardMessageCodec: + * + * #FlStandardMessageCodec is an #FlMessageCodec that implements the Flutter + * standard message encoding. This codec encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_NULL, #FL_VALUE_TYPE_BOOL, #FL_VALUE_TYPE_INT, + * #FL_VALUE_TYPE_FLOAT, #FL_VALUE_TYPE_STRING, #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST, and #FL_VALUE_TYPE_MAP. + * + * #FlStandardMessageCodec matches the StandardCodec class in the Flutter + * services library. + */ + +/* + * fl_standard_message_codec_new: + * + * Creates an #FlStandardMessageCodec. + * + * Returns: a new #FlStandardMessageCodec. + */ +FlStandardMessageCodec* fl_standard_message_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_MESSAGE_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h new file mode 100644 index 0000000..1685ebc --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_method_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStandardMethodCodec, + fl_standard_method_codec, + FL, + STANDARD_METHOD_CODEC, + FlMethodCodec) + +/** + * FlStandardMethodCodec: + * + * #FlStandardMethodCodec is an #FlMethodCodec that implements method calls + * using the Flutter standard message encoding. It should be used with a + * #FlMethodChannel. + * + * #FlStandardMethodCodec matches the StandardMethodCodec class in the Flutter + * services library. + */ + +/** + * fl_standard_method_codec_new: + * + * Creates an #FlStandardMethodCodec. + * + * Returns: a new #FlStandardMethodCodec. + */ +FlStandardMethodCodec* fl_standard_method_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STANDARD_METHOD_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h new file mode 100644 index 0000000..8f49e9f --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h @@ -0,0 +1,44 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include "fl_message_codec.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlStringCodec, + fl_string_codec, + FL, + STRING_CODEC, + FlMessageCodec) + +/** + * FlStringCodec: + * + * #FlStringCodec is an #FlMessageCodec that implements the Flutter string + * message encoding. This only encodes and decodes #FlValue of type + * #FL_VALUE_TYPE_STRING, other types #FlValues will generate an error during + * encoding. + * + * #FlStringCodec matches the StringCodec class in the Flutter services library. + */ + +/** + * fl_string_codec_new: + * + * Creates an #FlStringCodec. + * + * Returns: a new #FlStringCodec. + */ +FlStringCodec* fl_string_codec_new(); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_STRING_CODEC_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h new file mode 100644 index 0000000..45ceb51 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture.h @@ -0,0 +1,35 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlTexture, fl_texture, FL, TEXTURE, GObject) + +/** + * FlTexture: + * + * #FlTexture represents a texture. + * + * You can derive #FlTextureGL for populating hardware-accelerated textures or + * instantiate #FlPixelBufferTexture for populating pixel buffers. Do NOT + * directly implement this interface. + */ + +struct _FlTextureInterface { + GTypeInterface g_iface; +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h new file mode 100644 index 0000000..949f4af --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_gl.h @@ -0,0 +1,103 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_GL_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_GL_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_DERIVABLE_TYPE(FlTextureGL, fl_texture_gl, FL, TEXTURE_GL, GObject) + +/** + * FlTextureGL: + * + * #FlTextureGL is an abstract class that represents an OpenGL texture. + * + * If you want to render textures in other OpenGL context, create and use the + * #GdkGLContext by calling gdk_window_create_gl_context () with the #GdkWindow + * of #FlView. The context will be shared with the one used by Flutter. + * + * The following example shows how to implement an #FlTextureGL. + * ![ + * #include + * + * // Type definition, constructor, init, destructor, and class_init are + * // omitted. + * struct _VideoTextureGL { // extends FlTextureGL + * FlTextureGL parent_instance; + * + * GLuint texture_id; + * }; + * + * G_DEFINE_TYPE(VideoTexture, + * video_texture, + * fl_texture_gl_get_type ()) + * + * static gboolean + * video_texture_populate (FlTextureGL *texture, + * uint32_t *target, + * uint32_t *name, + * uint32_t *width, + * uint32_t *height, + * GError **error) { + * VideoTextureGL *self = VIDEO_TEXTURE_GL (texture); + * if (self->texture_id == 0) { + * glGenTextures (1, &self->texture_id); + * glBindTexture (GL_TEXTURE_2D, self->texture_id); + * // further configuration here. + * } else { + * glBindTexture (GL_TEXTURE_2D, self->texture_id); + * } + * + * // For example, we render pixel buffer here. + * // Note that Flutter only accepts textures in GL_RGBA8 format. + * static char buffer[] = { 0x1f, 0x2f, 0x3f, 0x4f }; // 1x1 pixel. + * glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, + * GL_UNSIGNED_BYTE, buffer); + * + * *target = GL_TEXTURE_2D; + * *name = self->texture_id; + * *width = 1; + * *height = 1; + * + * return TRUE; + * } + * ]| + */ + +struct _FlTextureGLClass { + GObjectClass parent_class; + + /** + * Virtual method called when Flutter populates this texture. The OpenGL + * context used by Flutter has been already set. + * @texture: an #FlTexture. + * @target: texture target (example GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE). + * @name: (out): name of texture. + * @width: (inout): width of the texture in pixels. + * @height: (inout): height of the texture in pixels. + * @error: (allow-none): #GError location to store the error occurring, or + * %NULL to ignore. + * + * Returns: %TRUE on success. + */ + gboolean (*populate)(FlTextureGL* texture, + uint32_t* target, + uint32_t* name, + uint32_t* width, + uint32_t* height, + GError** error); +}; + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h new file mode 100644 index 0000000..1c03cdc --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_texture_registrar.h @@ -0,0 +1,91 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include +#include + +#include "fl_texture.h" + +G_BEGIN_DECLS + +G_DECLARE_INTERFACE(FlTextureRegistrar, + fl_texture_registrar, + FL, + TEXTURE_REGISTRAR, + GObject) + +struct _FlTextureRegistrarInterface { + GTypeInterface parent_iface; + + gboolean (*register_texture)(FlTextureRegistrar* registrar, + FlTexture* texture); + + FlTexture* (*lookup_texture)(FlTextureRegistrar* registrar, int64_t id); + + gboolean (*mark_texture_frame_available)(FlTextureRegistrar* registrar, + FlTexture* texture); + + gboolean (*unregister_texture)(FlTextureRegistrar* registrar, + FlTexture* texture); +}; + +/** + * FlTextureRegistrar: + * + * #FlTextureRegistrar is used when registering textures. + * + * Flutter Framework accesses your texture by the related unique texture ID. To + * draw your texture in Dart, you should add Texture widget in your widget tree + * with the same texture ID. Use platform channels to send this unique texture + * ID to the Dart side. + */ + +/** + * fl_texture_registrar_register_texture: + * @registrar: an #FlTextureRegistrar. + * @texture: an #FlTexture for registration. + * + * Registers a texture. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_register_texture(FlTextureRegistrar* registrar, + FlTexture* texture); + +/** + * fl_texture_registrar_mark_texture_frame_available: + * @registrar: an #FlTextureRegistrar. + * @texture: the texture that has a frame available. + * + * Notifies the flutter engine that the texture object has updated and needs to + * be rerendered. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_mark_texture_frame_available( + FlTextureRegistrar* registrar, + FlTexture* texture); + +/** + * fl_texture_registrar_unregister_texture: + * @registrar: an #FlTextureRegistrar. + * @texture: the texture being unregistered. + * + * Unregisters an existing texture object. + * + * Returns: %TRUE on success. + */ +gboolean fl_texture_registrar_unregister_texture(FlTextureRegistrar* registrar, + FlTexture* texture); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TEXTURE_REGISTRAR_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_value.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_value.h new file mode 100644 index 0000000..7365d46 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_value.h @@ -0,0 +1,614 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ + +#include +#include +#include + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +G_BEGIN_DECLS + +/** + * FlValue: + * + * #FlValue is an object that contains the data types used in the platform + * channel used by Flutter. + * + * In Dart the values are represented as follows: + * - #FL_VALUE_TYPE_NULL: Null + * - #FL_VALUE_TYPE_BOOL: bool + * - #FL_VALUE_TYPE_INT: num + * - #FL_VALUE_TYPE_FLOAT: num + * - #FL_VALUE_TYPE_STRING: String + * - #FL_VALUE_TYPE_UINT8_LIST: Uint8List + * - #FL_VALUE_TYPE_INT32_LIST: Int32List + * - #FL_VALUE_TYPE_INT64_LIST: Int64List + * - #FL_VALUE_TYPE_FLOAT32_LIST: Float32List + * - #FL_VALUE_TYPE_FLOAT_LIST: Float64List + * - #FL_VALUE_TYPE_LIST: List + * - #FL_VALUE_TYPE_MAP: Map + * + * See #FlMessageCodec to encode and decode these values. + */ +typedef struct _FlValue FlValue; + +/** + * FlValueType: + * @FL_VALUE_TYPE_NULL: The null value. + * @FL_VALUE_TYPE_BOOL: A boolean. + * @FL_VALUE_TYPE_INT: A 64 bit signed integer. + * @FL_VALUE_TYPE_FLOAT: A 64 bit floating point number. + * @FL_VALUE_TYPE_STRING: UTF-8 text. + * @FL_VALUE_TYPE_UINT8_LIST: An ordered list of unsigned 8 bit integers. + * @FL_VALUE_TYPE_INT32_LIST: An ordered list of 32 bit integers. + * @FL_VALUE_TYPE_INT64_LIST: An ordered list of 64 bit integers. + * @FL_VALUE_TYPE_FLOAT_LIST: An ordered list of floating point numbers. + * @FL_VALUE_TYPE_LIST: An ordered list of #FlValue objects. + * @FL_VALUE_TYPE_MAP: A map of #FlValue objects keyed by #FlValue object. + * @FL_VALUE_TYPE_FLOAT32_LIST: An ordered list of 32bit floating point numbers. + * + * Types of #FlValue. + */ +typedef enum { + FL_VALUE_TYPE_NULL, + FL_VALUE_TYPE_BOOL, + FL_VALUE_TYPE_INT, + FL_VALUE_TYPE_FLOAT, + FL_VALUE_TYPE_STRING, + FL_VALUE_TYPE_UINT8_LIST, + FL_VALUE_TYPE_INT32_LIST, + FL_VALUE_TYPE_INT64_LIST, + FL_VALUE_TYPE_FLOAT_LIST, + FL_VALUE_TYPE_LIST, + FL_VALUE_TYPE_MAP, + FL_VALUE_TYPE_FLOAT32_LIST, +} FlValueType; + +/** + * fl_value_new_null: + * + * Creates an #FlValue that contains a null value. The equivalent Dart type is + * null. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_null(); + +/** + * fl_value_new_bool: + * @value: the value. + * + * Creates an #FlValue that contains a boolean value. The equivalent Dart type + * is a bool. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_bool(bool value); + +/** + * fl_value_new_int: + * @value: the value. + * + * Creates an #FlValue that contains an integer number. The equivalent Dart type + * is a num. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int(int64_t value); + +/** + * fl_value_new_float: + * @value: the value. + * + * Creates an #FlValue that contains a floating point number. The equivalent + * Dart type is a num. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float(double value); + +/** + * fl_value_new_string: + * @value: a %NULL-terminated UTF-8 string. + * + * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a + * String. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_string(const gchar* value); + +/** + * fl_value_new_string_sized: + * @value: a buffer containing UTF-8 text. It does not require a nul terminator. + * @value_length: the number of bytes to use from @value. + * + * Creates an #FlValue that contains UTF-8 text. The equivalent Dart type is a + * String. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_string_sized(const gchar* value, size_t value_length); + +/** + * fl_value_new_uint8_list: + * @value: an array of unsigned 8 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 8 bit unsigned integers. The data is + * copied. The equivalent Dart type is a Uint8List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_uint8_list(const uint8_t* value, size_t value_length); + +/** + * fl_value_new_uint8_list_from_bytes: + * @value: a #GBytes. + * + * Creates an ordered list containing 8 bit unsigned integers. The data is + * copied. The equivalent Dart type is a Uint8List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_uint8_list_from_bytes(GBytes* value); + +/** + * fl_value_new_int32_list: + * @value: an array of signed 32 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 32 bit integers. The equivalent Dart type + * is a Int32List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int32_list(const int32_t* value, size_t value_length); + +/** + * fl_value_new_int64_list: + * @value: an array of signed 64 bit integers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 64 bit integers. The equivalent Dart type + * is a Int64List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_int64_list(const int64_t* value, size_t value_length); + +/** + * fl_value_new_float32_list: + * @value: an array of floating point numbers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing 32 bit floating point numbers. + * The equivalent Dart type is a Float32List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float32_list(const float* value, size_t value_length); + +/** + * fl_value_new_float_list: + * @value: an array of floating point numbers. + * @value_length: number of elements in @value. + * + * Creates an ordered list containing floating point numbers. The equivalent + * Dart type is a Float64List. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_float_list(const double* value, size_t value_length); + +/** + * fl_value_new_list: + * + * Creates an ordered list. Children can be added to the list using + * fl_value_append(). The children are accessed using fl_value_get_length() + * and fl_value_get_list_value(). The equivalent Dart type is a List. + * + * The following example shows a simple list of values: + * + * |[ + * g_autoptr(FlValue) value = fl_value_new_list (); + * fl_value_append_take (value, fl_value_new_string ("one"); + * fl_value_append_take (value, fl_value_new_int (2); + * fl_value_append_take (value, fl_value_new_double (3.0); + * ]| + * + * This value can be decoded using: + * + * |[ + * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_LIST); + * for (size_t i = 0; i < fl_value_get_length (value); i++) { + * FlValue *child = fl_value_get_list_value (value, i); + * process_value (child); + * } + * ]| + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_list(); + +/** + * fl_value_new_list_from_strv: + * @value: a %NULL-terminated array of strings. + * + * Creates an ordered list containing #FlString values. + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_list_from_strv(const gchar* const* value); + +/** + * fl_value_new_map: + * + * Creates an ordered associative array. Children can be added to the map + * using fl_value_set(), fl_value_set_take(), fl_value_set_string(), + * fl_value_set_string_take(). The children are accessed using + * fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), + * fl_value_lookup() and fl_value_lookup_string(). The equivalent Dart type is a + * Map. + * + * The following example shows how to create a map of values keyed by strings: + * + * |[ + * g_autoptr(FlValue) value = fl_value_new_map (); + * fl_value_set_string_take (value, "name", fl_value_new_string ("Gandalf")); + * fl_value_set_string_take (value, "occupation", + * fl_value_new_string ("Wizard")); + * fl_value_set_string_take (value, "age", fl_value_new_int (2019)); + * ]| + * + * This value can be decoded using: + * |[ + * g_assert (fl_value_get_type (value) == FL_VALUE_TYPE_MAP); + * FlValue *name = fl_value_lookup_string (value, "name"); + * g_assert (fl_value_get_type (name) == FL_VALUE_TYPE_STRING); + * FlValue *age = fl_value_lookup_string (value, "age"); + * g_assert (fl_value_get_type (age) == FL_VALUE_TYPE_INT); + * g_message ("Next customer is %s (%d years old)", + * fl_value_get_string (name), + * fl_value_get_int (age)); + * ]| + * + * Returns: a new #FlValue. + */ +FlValue* fl_value_new_map(); + +/** + * fl_value_ref: + * @value: an #FlValue. + * + * Increases the reference count of an #FlValue. + * + * Returns: the value that was referenced. + */ +FlValue* fl_value_ref(FlValue* value); + +/** + * fl_value_unref: + * @value: an #FlValue. + * + * Decreases the reference count of an #FlValue. When the reference count hits + * zero @value is destroyed and no longer valid. + */ +void fl_value_unref(FlValue* value); + +/** + * fl_value_get_type: + * @value: an #FlValue. + * + * Gets the type of @value. + * + * Returns: an #FlValueType. + */ +FlValueType fl_value_get_type(FlValue* value); + +/** + * fl_value_equal: + * @a: an #FlValue. + * @b: an #FlValue. + * + * Compares two #FlValue to see if they are equivalent. Two values are + * considered equivalent if they are of the same type and their data is the same + * including any child values. For values of type #FL_VALUE_TYPE_MAP the order + * of the values does not matter. + * + * Returns: %TRUE if both values are equivalent. + */ +bool fl_value_equal(FlValue* a, FlValue* b); + +/** + * fl_value_append: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @child: an #FlValue. + * + * Adds @child to the end of @value. Calling this with an #FlValue that is not + * of type #FL_VALUE_TYPE_LIST is a programming error. + */ +void fl_value_append(FlValue* value, FlValue* child); + +/** + * fl_value_append_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @child: (transfer full): an #FlValue. + * + * Adds @child to the end of @value. Ownership of @child is taken by @value. + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_LIST is a + * programming error. + */ +void fl_value_append_take(FlValue* value, FlValue* child); + +/** + * fl_value_set: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: an #FlValue. + * @child_value: an #FlValue. + * + * Sets @key in @value to @child_value. If an existing value was in the map with + * the same key it is replaced. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set(FlValue* value, FlValue* key, FlValue* child_value); + +/** + * fl_value_set_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: (transfer full): an #FlValue. + * @child_value: (transfer full): an #FlValue. + * + * Sets @key in @value to @child_value. Ownership of both @key and @child_value + * is taken by @value. If an existing value was in the map with the same key it + * is replaced. Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set_take(FlValue* value, FlValue* key, FlValue* child_value); + +/** + * fl_value_set_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a UTF-8 text key. + * @child_value: an #FlValue. + * + * Sets a value in the map with a text key. If an existing value was in the map + * with the same key it is replaced. Calling this with an #FlValue that is not + * of type #FL_VALUE_TYPE_MAP is a programming error. + */ +void fl_value_set_string(FlValue* value, + const gchar* key, + FlValue* child_value); + +/** + * fl_value_set_string_take: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a UTF-8 text key. + * @child_value: (transfer full): an #FlValue. + * + * Sets a value in the map with a text key, taking ownership of the value. If an + * existing value was in the map with the same key it is replaced. Calling this + * with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a programming + * error. + */ +void fl_value_set_string_take(FlValue* value, + const gchar* key, + FlValue* child_value); + +/** + * fl_value_get_bool: + * @value: an #FlValue of type #FL_VALUE_TYPE_BOOL. + * + * Gets the boolean value of @value. Calling this with an #FlValue that is + * not of type #FL_VALUE_TYPE_BOOL is a programming error. + * + * Returns: a boolean value. + */ +bool fl_value_get_bool(FlValue* value); + +/** + * fl_value_get_int: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT. + * + * Gets the integer number of @value. Calling this with an #FlValue that is + * not of type #FL_VALUE_TYPE_INT is a programming error. + * + * Returns: an integer number. + */ +int64_t fl_value_get_int(FlValue* value); + +/** + * fl_value_get_float: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT. + * + * Gets the floating point number of @value. Calling this with an #FlValue + * that is not of type #FL_VALUE_TYPE_FLOAT is a programming error. + * + * Returns: a floating point number. + */ +double fl_value_get_float(FlValue* value); + +/** + * fl_value_get_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_STRING. + * + * Gets the UTF-8 text contained in @value. Calling this with an #FlValue + * that is not of type #FL_VALUE_TYPE_STRING is a programming error. + * + * Returns: a UTF-8 encoded string. + */ +const gchar* fl_value_get_string(FlValue* value); + +/** + * fl_value_get_length: + * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST, + * #FL_VALUE_TYPE_INT32_LIST, #FL_VALUE_TYPE_INT64_LIST, + * #FL_VALUE_TYPE_FLOAT32_LIST, #FL_VALUE_TYPE_FLOAT_LIST, #FL_VALUE_TYPE_LIST + * or #FL_VALUE_TYPE_MAP. + * + * Gets the number of elements @value contains. This is only valid for list + * and map types. Calling this with other types is a programming error. + * + * Returns: the number of elements inside @value. + */ +size_t fl_value_get_length(FlValue* value); + +/** + * fl_value_get_uint8_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_UINT8_LIST. + * + * Gets the array of unisigned 8 bit integers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_UINT8_LIST is a programming error. + * + * Returns: an array of unsigned 8 bit integers. + */ +const uint8_t* fl_value_get_uint8_list(FlValue* value); + +/** + * fl_value_get_int32_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT32_LIST. + * + * Gets the array of 32 bit integers @value contains. The data contains + * fl_value_get_length() elements. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_INT32_LIST is a programming error. + * + * Returns: an array of 32 bit integers. + */ +const int32_t* fl_value_get_int32_list(FlValue* value); + +/** + * fl_value_get_int64_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_INT64_LIST. + * + * Gets the array of 64 bit integers @value contains. The data contains + * fl_value_get_length() elements. Calling this with an #FlValue that is not of + * type #FL_VALUE_TYPE_INT64_LIST is a programming error. + * + * Returns: an array of 64 bit integers. + */ +const int64_t* fl_value_get_int64_list(FlValue* value); + +/** + * fl_value_get_float32_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT32_LIST. + * + * Gets the array of floating point numbers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_FLOAT32_LIST is a programming error. + * + * Returns: an array of floating point numbers. + */ +const float* fl_value_get_float32_list(FlValue* value); + +/** + * fl_value_get_float_list: + * @value: an #FlValue of type #FL_VALUE_TYPE_FLOAT_LIST. + * + * Gets the array of floating point numbers @value contains. The data + * contains fl_value_get_length() elements. Calling this with an #FlValue that + * is not of type #FL_VALUE_TYPE_FLOAT_LIST is a programming error. + * + * Returns: an array of floating point numbers. + */ +const double* fl_value_get_float_list(FlValue* value); + +/** + * fl_value_get_list_value: + * @value: an #FlValue of type #FL_VALUE_TYPE_LIST. + * @index: an index in the list. + * + * Gets a child element of the list. It is a programming error to request an + * index that is outside the size of the list as returned from + * fl_value_get_length(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_LIST is a programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_list_value(FlValue* value, size_t index); + +/** + * fl_value_get_map_key: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @index: an index in the map. + * + * Gets a key from the map. It is a programming error to request an index that + * is outside the size of the list as returned from fl_value_get_length(). + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a + * programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_map_key(FlValue* value, size_t index); + +/** + * fl_value_get_map_value: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @index: an index in the map. + * + * Gets a value from the map. It is a programming error to request an index that + * is outside the size of the list as returned from fl_value_get_length(). + * Calling this with an #FlValue that is not of type #FL_VALUE_TYPE_MAP is a + * programming error. + * + * Returns: an #FlValue. + */ +FlValue* fl_value_get_map_value(FlValue* value, size_t index); + +/** + * fl_value_lookup: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a key value. + * + * Gets the map entry that matches @key. Keys are checked using + * fl_value_equal(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + * + * Map lookups are not optimized for performance - if you have a large map or + * need frequent access you should copy the data into another structure, e.g. + * #GHashTable. + * + * Returns: (allow-none): the value with this key or %NULL if not one present. + */ +FlValue* fl_value_lookup(FlValue* value, FlValue* key); + +/** + * fl_value_lookup_string: + * @value: an #FlValue of type #FL_VALUE_TYPE_MAP. + * @key: a key value. + * + * Gets the map entry that matches @key. Keys are checked using + * fl_value_equal(). Calling this with an #FlValue that is not of type + * #FL_VALUE_TYPE_MAP is a programming error. + * + * Map lookups are not optimized for performance - if you have a large map or + * need frequent access you should copy the data into another structure, e.g. + * #GHashTable. + * + * Returns: (allow-none): the value with this key or %NULL if not one present. + */ +FlValue* fl_value_lookup_string(FlValue* value, const gchar* key); + +/** + * fl_value_to_string: + * @value: an #FlValue. + * + * Converts an #FlValue to a text representation, suitable for logging purposes. + * The text is formatted to be the equivalent of Dart toString() methods. + * + * Returns: UTF-8 text. + */ +gchar* fl_value_to_string(FlValue* value); + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(FlValue, fl_value_unref) + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_VALUE_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_view.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_view.h new file mode 100644 index 0000000..f93f385 --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/fl_view.h @@ -0,0 +1,61 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ + +#if !defined(__FLUTTER_LINUX_INSIDE__) && !defined(FLUTTER_LINUX_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +#include "fl_dart_project.h" +#include "fl_engine.h" + +G_BEGIN_DECLS + +G_DECLARE_FINAL_TYPE(FlView, fl_view, FL, VIEW, GtkContainer) + +/** + * FlView: + * + * #FlView is a GTK widget that is capable of displaying a Flutter application. + * + * The following example shows how to set up a view in a GTK application: + * |[ + * FlDartProject *project = fl_dart_project_new (); + * FlView *view = fl_view_new (project); + * gtk_widget_show (GTK_WIDGET (view)); + * gtk_container_add (GTK_CONTAINER (parent), view); + * + * FlBinaryMessenger *messenger = + * fl_engine_get_binary_messenger (fl_view_get_engine (view)); + * setup_channels_or_plugins (messenger); + * ]| + */ + +/** + * fl_view_new: + * @project: The project to show. + * + * Creates a widget to show Flutter application. + * + * Returns: a new #FlView. + */ +FlView* fl_view_new(FlDartProject* project); + +/** + * fl_view_get_engine: + * @view: an #FlView. + * + * Gets the engine being rendered in the view. + * + * Returns: an #FlEngine. + */ +FlEngine* fl_view_get_engine(FlView* view); + +G_END_DECLS + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_VIEW_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h new file mode 100644 index 0000000..2d9317d --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/flutter_linux/flutter_linux.h @@ -0,0 +1,37 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ +#define FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ + +#define __FLUTTER_LINUX_INSIDE__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#undef __FLUTTER_LINUX_INSIDE__ + +#endif // FLUTTER_SHELL_PLATFORM_LINUX_FLUTTER_LINUX_H_ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/generated_config.cmake b/packages/fl_query_hooks/example/linux/flutter/ephemeral/generated_config.cmake new file mode 100644 index 0000000..90b082b --- /dev/null +++ b/packages/fl_query_hooks/example/linux/flutter/ephemeral/generated_config.cmake @@ -0,0 +1,15 @@ +# Generated code do not commit. +file(TO_CMAKE_PATH "/opt/flutter" FLUTTER_ROOT) +file(TO_CMAKE_PATH "/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example" PROJECT_DIR) + +# Environment variables to pass to tool_backend.sh +list(APPEND FLUTTER_TOOL_ENVIRONMENT + "FLUTTER_ROOT=/opt/flutter" + "PROJECT_DIR=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example" + "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" + "DART_OBFUSCATION=false" + "TRACK_WIDGET_CREATION=true" + "TREE_SHAKE_ICONS=false" + "PACKAGE_CONFIG=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example/.dart_tool/package_config.json" + "FLUTTER_TARGET=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example/lib/main.dart" +) diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/icudtl.dat b/packages/fl_query_hooks/example/linux/flutter/ephemeral/icudtl.dat new file mode 100644 index 0000000..d733c28 Binary files /dev/null and b/packages/fl_query_hooks/example/linux/flutter/ephemeral/icudtl.dat differ diff --git a/packages/fl_query_hooks/example/linux/flutter/ephemeral/libflutter_linux_gtk.so b/packages/fl_query_hooks/example/linux/flutter/ephemeral/libflutter_linux_gtk.so new file mode 100644 index 0000000..5511cd0 Binary files /dev/null and b/packages/fl_query_hooks/example/linux/flutter/ephemeral/libflutter_linux_gtk.so differ diff --git a/packages/fl_query_hooks/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/packages/fl_query_hooks/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig new file mode 100644 index 0000000..eb12cc6 --- /dev/null +++ b/packages/fl_query_hooks/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -0,0 +1,11 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/opt/flutter +FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example +COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_BUILD_DIR=build +FLUTTER_BUILD_NAME=1.0.0 +FLUTTER_BUILD_NUMBER=1 +DART_OBFUSCATION=false +TRACK_WIDGET_CREATION=false +TREE_SHAKE_ICONS=false +PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/packages/fl_query_hooks/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/packages/fl_query_hooks/example/macos/Flutter/ephemeral/flutter_export_environment.sh new file mode 100755 index 0000000..1ec1c91 --- /dev/null +++ b/packages/fl_query_hooks/example/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/opt/flutter" +export "FLUTTER_APPLICATION_PATH=/home/krtirtho/dev/fl-query/packages/fl_query_hooks/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/packages/fl_query_hooks/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows b/packages/fl_query_hooks/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows new file mode 120000 index 0000000..6e3df44 --- /dev/null +++ b/packages/fl_query_hooks/example/windows/flutter/ephemeral/.plugin_symlinks/connectivity_plus_windows @@ -0,0 +1 @@ +/home/krtirtho/.pub-cache/hosted/pub.dartlang.org/connectivity_plus_windows-1.2.2/ \ No newline at end of file