flutter generate doesn't annotated classes for test directory - dependency-injection

So I've tried generate classes DI classes for the inject.dart using flutter generate
It seems to generate classes under lib/* but not for test/*. It does not throw any error as such. Here are my relevant flutter classes.
pubspec.yaml
name: gc_client
description: A gc
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
json_annotation: ^2.0.0
rxdart: ^0.22.0
dio: ^2.1.3
inject:
path: ./inject.dart/package/inject
builders:
json_serializable: ^2.0.0
inject_generator:
path: ./inject.dart/package/inject_generator
dev_dependencies:
test: 1.6.1
flutter_test:
sdk: flutter
mockito: ^4.0.0
flutter:
uses-material-design: true
fonts:
- family: Raleway
fonts:
- asset: assets/fonts/raleway_regular.ttf
- asset: assets/fonts/raleway_medium.ttf
weight: 700
assets:
- assets/
Component classes
Am I missing something? Let me know if you need more info. Thanks in advance.

The issue is with the build runner.
Here's a relevant fix for the same
https://github.com/flutter/flutter/issues/33266

Related

I keep on getting pubsepc.yaml error when running flutter?

name: churro
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.18.4 <3.0.0'
dependencies:
camera: ^0.10.0+4
story_view: ^0.14.0
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/images/
[churro] flutter pub get
Error detected in pubspec.yaml:
Unexpected child "sdk" found under "flutter".
Please correct the pubspec.yaml file
I believe the problem is your indentation being off. The following should resolve your issue:
name: churro
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.18.4 <3.0.0'
dependencies:
flutter:
sdk: flutter
camera: ^0.10.0+4
story_view: ^0.14.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/images/

Error: The non-abstract class 'InternalSelectableMathState' is missing implementations for these members:

I have a flutter app. It was working perfectly on my intel Mac mini.
Now, I am trying to run my app on my new M1 Macbook Pro 2020.
I completed all the steps correctly and run successfully example counter Flutter app on my new M1 Macbook Pro 2020.
https://docs.flutter.dev/get-started/test-drive?tab=vscode
I downloaded the latest Flutter version & latest VSCode & Latest Xcode.
on This new M1 macbook:
Flutter: 3.3.4
Xcode: 14.0.1
VSCode: 1.17.2
In fact my project was working without any problem on my older intel Mac Mini but versions was older.
on my older Intel Mac Mini:
Flutter: I don't remember but I am sure that it was not 3.3.4
Xcode: I don't remember but I am sure that it was not 14.0.1
VSCode: I don't remember.
Now, I am trying to Start Debugging on iPhone 14 Pro Max(iOS 16) but it gives error.
../../../../../../Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_math_fork-0.3.3+1/lib/src/widgets/selectable.dart:407:7: Error: The
non-abstract class 'InternalSelectableMathState' is missing implementations for these members:
- TextInputClient.insertTextPlaceholder
- TextInputClient.removeTextPlaceholder
- TextSelectionDelegate.copySelection
- TextSelectionDelegate.cutSelection
- TextSelectionDelegate.pasteText
- TextSelectionDelegate.selectAll
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
There is no
flutter_math_fork
dependency in my project but interestingly it says this library is problematic. How can it be possible? I did not use this library.
pubspec.yaml
name: app
description: Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
badges: ^2.0.1
cached_network_image: ^3.0.0
cloud_firestore: ^2.3.0
cupertino_icons: ^1.0.3
dots_indicator: ^2.0.0
easy_localization: ^3.0.0
firebase_auth: ^2.0.0
firebase_core: ^1.3.0
firebase_messaging: ^10.0.3
firebase_storage: ^9.0.0
flutter_web_browser: ^0.14.0
flutter_html: ^2.1.0
flutter_widget_from_html: ^0.6.1
google_fonts: ^2.1.0
google_sign_in: ^5.0.4
html: ^0.15.0
html_unescape: ^2.0.0
image_picker: ^0.8.1+3
intl: ^0.17.0
introduction_screen: ^2.1.0
launch_review: ^3.0.1
line_icons: ^2.0.1
lottie: ^1.1.0
package_info: ^2.0.2
path_provider: ^2.0.2
provider: ^5.0.0
share: ^2.0.4
shared_preferences: ^2.0.6
skeleton_text: ^3.0.0
fluttertoast: ^8.0.7
url_launcher: ^6.0.9
youtube_player_flutter: ^8.0.0
youtube_plyr_iframe: ^2.0.7
rounded_loading_button: ^2.0.5
firebase_analytics: ^8.1.2
flutter_facebook_auth: ^3.5.0
the_apple_sign_in: ^1.1.1
video_player: ^2.1.10
flick_video_player: ^0.3.1
flutter_icons:
git:
url: https://github.com/adarsh-technocrat/flutter-icons
md2_tab_indicator:
git:
url: https://github.com/westdabestdb/md2_tab_indicator
google_mobile_ads: ^1.0.1 #^0.13.2
facebook_audience_network: ^1.0.0-nullsafety.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.9.0"
flutter_icons:
android: "launcher_icon"
ios: true
remove_alpha_ios: true #added later.
image_path: "assets/images/icon.png"
# The following section is specific to Flutter.
flutter:
uses-material-design: true
assets:
- assets/images/
- assets/animation_files/
- assets/translations/
fonts:
- family: Poppins
fonts:
- asset: assets/fonts/Poppins-Light.ttf
weight: 400
- asset: assets/fonts/Poppins-Regular.ttf
weight: 500
- asset: assets/fonts/Poppins-Medium.ttf
weight: 600
- asset: assets/fonts/Poppins-SemiBold.ttf
weight: 700
- asset: assets/fonts/Poppins-Bold.ttf
weight: 800
- family: Open Sans
fonts:
- asset: assets/fonts/OpenSans-Light.ttf
weight: 400
- asset: assets/fonts/OpenSans-Regular.ttf
weight: 500
- family: Manrope
fonts:
# - asset: assets/fonts/Manrope-Light.ttf
# weight: 300
- asset: assets/fonts/Manrope-Regular.ttf
weight: 400
- asset: assets/fonts/Manrope-SemiBold.ttf
weight: 500
- asset: assets/fonts/Manrope-Medium.ttf
weight: 600
- asset: assets/fonts/Manrope-Bold.ttf
weight: 700
- asset: assets/fonts/Manrope-ExtraBold.ttf
weight: 900
Note that: I changed only platform :ios, '14.0' in Podfile. It was platform :ios, '10.0'
10.0 --> 14.0
If I make it 10.0 in this new M1 Macbook Pro, it gives
Stored properties cannot be marked potentially unavailable with
'#available',
error.
I changed it 10.0 --> 14.0 to solve this problem but now it gives
non-abstract class 'InternalSelectableMathState' is missing implementations for these members:
error as I stated above.
I'm new to Flutter, how can I solve my problem?
EDIT:
#Jora's solution is not working because I think
dependency_overrides:
flutter_math_fork: ^0.6.0
library conflicts with
provider: ^5.0.0
flick_video_player: ^0.3.1
flutter_widget_from_html: ^0.6.1
flutter_html: ^2.1.0
libraries. Then what is the simplest solution? Thanks...
The linked github issue mentions that this is a problem of flutter_math_fork.
You should upgrade it to a fixed version via
dependencies:
flutter_math_fork: ^0.6.0
or
dependency_overrides:
flutter_math_fork: ^0.6.0

Flutter IOS release size more than 400Mb

New to Flutter. I'm working on this app and on "flutter build ios --release" command is 407Mb on size, with apk instead i have 25Mb. I've tried downgrade flutter without results, still the same sizes even if my assets folder is just 8.6Mb. This is my yaml file:
name: ragogna
description: Nuova app per la comunita.
version: 1.0.0+1
environment:
sdk: '>=2.7.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
share: ^0.6.3+5
font_awesome_flutter: ^8.5.0
sliver_fill_remaining_box_adapter: ^0.1.1
url_launcher: ^5.4.1
provider: ^3.2.0
add_2_calendar: ^1.3.1
photo_view: ^0.9.2
cached_network_image: ^2.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
- assets/event_images/
- assets/locations/
- assets/itinerari/
fonts:
- family: Kievit
fonts:
- asset: fonts/Kievit-Book.ttf
- asset: fonts/Kievit-Medium.ttf
- family: Charter
fonts:
- asset: fonts/Charter.ttf

Unable to run flutter. Throws "couldn't find package fluttery:" error

This is the error
description: A new Flutter project.
version: 0.9.91+50
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
SDK: flutter
cupertino_icons: ^0.1.2
audioplayers: ^0.11.0
agora_rtc_engine: ^0.9.4
cached_network_image: ^0.7.0
country_pickers: ^1.0.1
dio: ^2.0.22
flutter_launcher_icons: ^0.7.0
flutter_rating: ^0.0.2
fluttery: ^0.0.8
font_awesome_flutter: ^8.4.0
get_it: ^1.0.3
google_sign_in: ^4.0.1+3
image_picker: ^0.5.0+3
intl: ^0.15.7
intro_views_flutter: ^2.4.0
permission_handler: ^3.0.0
photo_view: ^0.2.1
razorpay_plugin: ^0.2.9
rxdart: ^0.21.0
shared_preferences: ^0.5.1+1
side_header_list_view: ^0.0.4
strings: ^0.1.0
url_launcher: ^5.0.2
path_provider: ^0.5.0+1
screen: ^0.0.5
flutter_typeahead: ^1.4.0
flutter_chips_input: ^1.2.0
intro_slider: ^1.2.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_icons:
android: "ic_launcher"
ios: true
image_path: "assets/images/ic_launcher.jpg"
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/
This is my pubspec.YAML file.
I have installed flutter and tried to run an existing flutter project on iPhone.
When I try running flutter, I get this error.
I tried searching for solutions but couldn't find one. Can anyone let me know what needs to be done?
I cannot find fluttery package in pub
Maybe is deleted. Check fluttery_dart2 as an alternative.
This is happening because flutter configured podfile that way. Default generated podfile by flutter won't allow ios build to download the nested dependencies.
To resolve you can alter podfile file by this and your issue would be resolved.
Search for this piece of code
target 'Runner' do
# Flutter Pod
And replace it with below
target 'Runner' do
use_frameworks!
# Flutter Pod
Update
Fluttery package is removed/temporary down due to flutter upgrade. So you should update your pubspec.yaml file with
fluttery_dart2: ^0.0.9
library to use the same functionality. Well this library will not be for long time once the original one will back.
Please read the note here

unable to load image asset in Flutter error in pubspec file

i want to import image asset into my flutter project but unable to do so.
this is my pubspec.yaml file
i removed all the comments added by flutter
name: first_try
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
fonts:
- family: Raleway
fonts:
- asset: fonts/Raleway-Black.ttf
- family: Lato
fonts:
- asset: fonts/Lato-Regular.ttf #works till here
-assets:
-assets/
Error Given:
[first_try] flutter packages get
Running "flutter packages get" in first_try... 0.4s
Error detected in pubspec.yaml:
/properties/flutter/properties/assets: type: wanted [array] got -assets/
Please correct the pubspec.yaml file at B:\Flutter_Exercise\first_try\pubspec.yaml
exit code 1
[1]: https://i.stack.imgur.com/50OOV.png <=folder structure
I think you might have forgotten an whitespace.
Try the following:
flutter:
assets:
- assets/
notice the whitespace after the -
Furthermore, i think, you've removed the flutter section while removeing the comments. AFAIK, that's important :)
see https://flutter.dev/docs/development/ui/assets-and-images#specifying-assets for more information
You should be use only one tab space before "fonts" and plus tab when use "-" all of below.

Resources