Describe the bug/problem
Please describe the bug/problem here
The genai package currently has a hard dependency on the Flutter SDK. In its pubspec.yaml, it requires:
Additionally, ai_request_utils.dart imports package:flutter/foundation.dart solely to use debugPrint.
While similar issues were addressed for better_networking (e.g., #1360), this problem still exists in the genai package. This tight coupling to Flutter prevents the package from being used in pure Dart environments and blocks batch evaluation runs in headless Dart/CLI contexts.
Steps to Reproduce the bug/problem
Please provide the steps to reproduce the behaviour. Screenshot(s)/image(s) are preferred to help explain it better
-
Create a pure Dart CLI application or package (without Flutter).
-
Add the genai package from this workspace as a dependency.
-
Run:
-
Attempt to run a Dart script.
Result:
Expected behavior
Description of what you expected to happen
The genai package should be a pure Dart library without any dependency on the Flutter SDK.
Utilities like debugPrint should be replaced with:
print
dart:developer's log()
- or a dedicated logging package
This would allow seamless usage in Dart CLI, backend services, and other non-Flutter environments.
Device Info (The device where you encountered this issue)
- OS: MacOS (Applies to all Operating Systems)
- Version: Not Platform Specific
- Browser (only if you encountered the issue while running the web app): N/A
Flutter Doctor
Please run the flutter doctor -v command and provide the details below:
# N/A - Architectural/Dependency issue.
[✓] Flutter (Channel stable)
[✓] Dart SDK version: 3.x
Describe the bug/problem
Please describe the bug/problem here
The
genaipackage currently has a hard dependency on the Flutter SDK. In itspubspec.yaml, it requires:Additionally,
ai_request_utils.dartimportspackage:flutter/foundation.dartsolely to usedebugPrint.While similar issues were addressed for
better_networking(e.g., #1360), this problem still exists in thegenaipackage. This tight coupling to Flutter prevents the package from being used in pure Dart environments and blocks batch evaluation runs in headless Dart/CLI contexts.Steps to Reproduce the bug/problem
Please provide the steps to reproduce the behaviour. Screenshot(s)/image(s) are preferred to help explain it better
Create a pure Dart CLI application or package (without Flutter).
Add the
genaipackage from this workspace as a dependency.Run:
Attempt to run a Dart script.
Result:
It fails because the Flutter SDK is not available, or
Compilation fails due to the import:
Expected behavior
Description of what you expected to happen
The
genaipackage should be a pure Dart library without any dependency on the Flutter SDK.Utilities like
debugPrintshould be replaced with:printdart:developer'slog()This would allow seamless usage in Dart CLI, backend services, and other non-Flutter environments.
Device Info (The device where you encountered this issue)
Flutter Doctor
Please run the
flutter doctor -vcommand and provide the details below: