letsar / binder

A lightweight, yet powerful way to bind your application state with your business logic.
MIT License
178 stars 12 forks source link

Architecture example failing to run #5

Closed isinghmitesh closed 3 years ago

isinghmitesh commented 3 years ago

flutter run

lib/data/entities/user.dart:4:6: Error: Error when reading 'lib/data/entities/user.freezed.dart': No such file or directory
part 'user.freezed.dart';                                               
     ^                                                                  
lib/data/entities/user.dart:5:6: Error: Error when reading 'lib/data/entities/user.g.dart': No such file or directory
part 'user.g.dart';                                                     
     ^                                                                  
lib/data/entities/user.dart:4:6: Error: Can't use 'lib/data/entities/user.freezed.dart' as a part, because it has no 'part of' declaration.
part 'user.freezed.dart';                                               
     ^                                                                  
lib/data/entities/user.dart:5:6: Error: Can't use 'lib/data/entities/user.g.dart' as a part, because it has no 'part of' declaration.
part 'user.g.dart';                                                     
     ^                                                                  
lib/data/entities/user.dart:8:26: Error: Type '_$User' not found.       
abstract class User with _$User {                                       
                         ^^^^^^                                         
lib/data/entities/user.dart:8:16: Error: The type '_$User' can't be mixed in.
abstract class User with _$User {                                       
               ^                                                        
lib/data/entities/user.dart:16:8: Error: Couldn't find constructor '_User'.
  }) = _User;                                                           
       ^                                                                
lib/data/entities/user.dart:16:8: Error: Redirection constructor target not found: '_User'
  }) = _User;                                                           
       ^                                                                
lib/modules/home/view.dart:76:69: Error: The getter 'name' isn't defined for the class 'User'.
 - 'User' is from 'package:architecture/data/entities/user.dart' ('lib/data/entities/user.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    final name = context.watch(currentUserRef.select((user) => user.name));
                                                                    ^^^^
lib/modules/user/view.dart:25:69: Error: The getter 'name' isn't defined for the class 'User'.
 - 'User' is from 'package:architecture/data/entities/user.dart' ('lib/data/entities/user.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
    final name = context.watch(currentUserRef.select((user) => user.name));
                                                                    ^^^^
lib/data/entities/user.dart:18:55: Error: Method not found: '_$UserFromJson'.
  factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
                                                      ^^^^^^^^^^^^^^    
lib/data/sources/api_client.dart:42:52: Error: The method 'toJson' isn't defined for the class 'User'.
 - 'User' is from 'package:architecture/data/entities/user.dart' ('lib/data/entities/user.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toJson'.
  Map<String, dynamic> encode(User value) => value.toJson();            
                                                   ^^^^^^               

FAILURE: Build failed with an exception.                                

* Where:                                                                
Script '/home/mitesh/fvm/versions/stable/packages/flutter_tools/gradle/flutter.gradle' line: 904

* What went wrong:                                                      
Execution failed for task ':app:compileFlutterBuildDebug'.              
> Process 'command '/home/mitesh/fvm/versions/stable/bin/flutter'' finished with non-zero exit value 1

* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org                              

BUILD FAILED in 23s                                                     
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        23.8s
Exception: Gradle task assembleDebug failed with exit code 1
isinghmitesh commented 3 years ago

flutter doctor -v

[✓] Flutter (Channel stable, 1.22.3, on Linux, locale en_IN)
    • Flutter version 1.22.3 at /home/mitesh/fvm/versions/stable
    • Framework revision 8874f21e79 (5 weeks ago), 2020-10-29 14:14:35 -0700
    • Engine revision a1440ca392
    • Dart version 2.10.3

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /home/mitesh/Android/Sdk
    • Platform android-30, build-tools 29.0.2
    • ANDROID_HOME = /home/mitesh/Android/Sdk
    • Java binary at: /home/mitesh/F/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Android Studio (version 4.0)
    • Android Studio at /home/mitesh/F/android-studio
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.51.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.16.0

[✓] Connected device (1 available)
    • Redmi Note 4 (mobile) • 2685de490404 • android-arm64 • Android 7.0 (API 24)

• No issues found!
letsar commented 3 years ago

Hi @singhmitesh, oh I see, you need to run this command before running flutter run:

flutter pub run build_runner build

After that everything should be ok.

isinghmitesh commented 3 years ago

trying it right away :sweat_smile:

isinghmitesh commented 3 years ago

Works. Thank you :+1:

letsar commented 3 years ago

Great :-). I should put this in the readme ;-)

isinghmitesh commented 3 years ago

Great :-). I should put this in the readme ;-)

if you want I can do maybe a detailed readme and submit a PR?