Hello! Thanks for this awesome library. I have a issue with code generation on mobx_codegen.
I use ... build_runner clean and flutter clean and build_runner build --delete-conflicting-outputs - its not works
Build_runner example:
flutter packages pub run build_runner build --delete-conflicting-outputs --verbose
[INFO] Generating build script...
[INFO] Generating build script completed, took 321ms
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 10.0s
[INFO] BuildDefinition:Initializing inputs
[INFO] BuildDefinition:Building new asset graph...
[INFO] BuildDefinition:Building new asset graph completed, took 668ms
[INFO] BuildDefinition:Checking for unexpected pre-existing outputs....
[INFO] BuildDefinition:Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Build:Running build...
[INFO] Heartbeat:1.0s elapsed, 0/16 actions completed.
[INFO] Heartbeat:2.1s elapsed, 0/16 actions completed.
[INFO] Heartbeat:3.2s elapsed, 0/16 actions completed.
[INFO] Heartbeat:4.2s elapsed, 0/16 actions completed.
[INFO] Heartbeat:5.2s elapsed, 0/16 actions completed.
[FINE] mobx_codegen:mobx_generator on lib/components/auth_form.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/account_form.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/category_item.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/category_merging_modal.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/category_modal.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/delete_category_modal.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/float_btn.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/new_charts.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/manual_cart_input_modal.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/no_connection.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/products_by_categories.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/product_item.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/purchase.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/scanner_waiter.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/registration_form.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/product_filter.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/shop.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/statistic_item.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/statistic_charts.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/libraries/pie_chart.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/components/statistic_list.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/login/style/theme.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/login/utils/bubble_indication_painter.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/account_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/main.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/auth_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/cart_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/cart_request_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/category_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/month_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/product_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/purchase_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/qr_data_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/registration_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/request_error.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/refactoring/shop_model.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/route/routes.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/account_settings.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/additional_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/cart_editor.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/auth_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/category_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/fresh_login_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/intro_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/main_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/products_by_categories_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/scanner_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/registration_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/splash_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/statistic_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/screens/waiting_carts_screen.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/services/api_service.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/services/helper.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/services/request_service.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/services/server_routes.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/services/validators.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/store/state.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/custom_autocomplete.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/store/cart_store.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/custom_button.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/store/storage.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/custom_void_field.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/custorm_field.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/custorm_select.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/empty_box.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/SimpleTextField.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/validators/validators.dart:Running StoreGenerator
[FINE] mobx_codegen:mobx_generator on lib/ui/wave.dart:Running StoreGenerator
[INFO] Build:Running build completed, took 12.9s
[INFO] Build:Caching finalized dependency graph...
[INFO] Build:Caching finalized dependency graph completed, took 76ms
[INFO] Build:Succeeded after 12.9s with 0 outputs (136 actions)
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.8.1-pre.46, on Microsoft Windows [Version 10.0.18932.1000], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
[√] Android Studio (version 3.4)
[√] VS Code, 64-bit edition (version 1.35.1)
[√] Connected device (3 available)
! Doctor found issues in 1 category.
P.S. To prevent questions about FD issue - im developing app for android, not for windows :)
Could you please share your pubspec.yaml as well ?
Also I noticed you are on master channel, which occasionally might not be stable. Can you try this on the stable/beta channel just to verify ?
@pavanpodila , thanks for fast answer!
I switch flutter channel to stable and update it:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.7.8+hotfix.3, on Microsoft Windows [Version 10.0.18932.1000], locale ru-RU)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 3.4)
[√] VS Code, 64-bit edition (version 1.35.1)
[√] Connected device (1 available)
• No issues found!
But it still "0 outputs";
That is my pubspec file:
name: app
description: description
version: 1.1.0
environment:
sdk: ">=2.2.2"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
http:
mobx: ^0.2.1+1
flutter_mobx: ^0.2.2
mobx_codegen: ^0.2.1+1
date_format: ^1.0.6
localstorage: ^2.0.0
wave: ^0.0.8
bubble_bottom_bar:
git: [email protected]:westdabestdb/bubble_bottom_bar.git
sliding_up_panel: ^0.3.4
fast_qr_reader_view:
git: [email protected]:facundomedica/fast_qr_reader_view.git
permission_handler: ^3.1.0
flutter_colorpicker: ^0.2.5
groovin_widgets: ^1.4.2
flutter_typeahead: ^1.6.1
keyboard_visibility: ^0.5.6
flutter_masked_text: ^0.8.0
uuid: ^2.0.2
intro_views_flutter: ^2.6.0
pull_to_refresh: ^1.4.4
charts_flutter: ^0.6.0
sticky_header_list: ^1.0.6
font_awesome_flutter: ^8.4.0
dev_dependencies:
build_runner: ^1.5.2
flutter:
uses-material-design: true
assets:
- assets/
fonts:
- family: Exo2
fonts:
- asset: fonts/Exo2-Regular.ttf
After this experiment i update mobx libs and build_runner lib to their latest versions:
mobx: ^0.3.3+2
flutter_mobx: ^0.3.0+1
mobx_codegen: ^0.3.3+1
dev_dependencies:
build_runner: ^1.6.1
But no effects too. Before each action i do flutter clean and ...build_runner clean.
Make sure you are using the Store as a mixin instead of an interface.
Can you share your Store class definition?
Yes, its mixin
import 'package:localstorage/localstorage.dart';
import 'package:mobx/mobx.dart';
import 'package:quich/services/api_service.dart';
part 'state.g.dart';
abstract class AppStoreBase implements Store {
LocalStorage storage = LocalStorage('quich');
final ApiService apiService = ApiService();
/// MANY CODE HERE
}
/* App store singletone */
class AppStore extends AppStoreBase with _$AppStore {
factory AppStore() {
return _singleton;
}
AppStore._internal();
AppStore reset() {
return AppStore._internal();
}
static final AppStore _singleton = AppStore._internal();
@override
void dispose() {
print('DISPOSE STORE');
}
}
AppStore $store = AppStore();
Solved! Thanks, i use "Store" as interface, but i think it about generated .g.dart file!
I change abstract class AppStoreBase implements Store to abstract class AppStoreBase with Store and it works on latest master flutter version
import 'package:mobx/mobx.dart';
part 'list_store.g.dart';
class ListStore = _ListStore with _$ListStore;
abstract class _ListStore with Store {
}
Still in trouble
[INFO] Succeeded after 17.8s with 0 outputs (10 actions)
I had this issue, and it was caused by me forgetting to put my code in lib/, and leaving it in the directory above. Figured I'd share my stupidity in case anyone else has done this.
Most helpful comment
I had this issue, and it was caused by me forgetting to put my code in
lib/, and leaving it in the directory above. Figured I'd share my stupidity in case anyone else has done this.