PythonBridge class
The main class for interacting with Python code in Flutter.
Constructors
-
PythonBridge.new({String? pythonExecutablePath, List<
String> additionalPythonPaths = const [], bool useChaquopyOnAndroid = true}) - Creates a new PythonBridge instance.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- useChaquopyOnAndroid → bool
-
Whether to use Chaquopy on Android (if available)
final
Methods
-
createPythonScript(
String pythonCode, {String? fileName}) → Future< String> - Creates a Python script file with the given content and returns the file path.
-
getPythonVersion(
) → Future< String?> - Gets the Python version.
-
installPackage(
String packageName) → Future< PythonResult> - Installs a Python package using pip.
-
isPythonAvailable(
) → Future< bool> - Checks if Python is installed and available.
-
isWeb(
) → bool - Helper method to detect if running on web platform
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
runCode(
String code) → Future< PythonResult> - Runs Python code and returns the result.
-
runScript(
String scriptPath) → Future< PythonResult> - Runs a Python script file and returns the result.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited