go-flutter-desktop / go-flutter

Flutter on Windows, MacOS and Linux - based on Flutter Embedding, Go and GLFW.
https://hover.build/
BSD 3-Clause "New" or "Revised" License
5.84k stars 286 forks source link

Example project 'stocks' doesn't work #687

Closed lkhorasandzhian closed 1 year ago

lkhorasandzhian commented 1 year ago

Description

I tried to run your 'stocks' project for checking whether my hover had been successfully set up, but I got error below. Then I did the same for another project ('pointer_demo'), and it ran without any error. Maybe I was doing something wrong... Anyway, I'm waiting for your response!

Hover doctor

D:\source\repos\dart_solutions\tutorial_sample\examples\stocks>hover doctor
hover: Hover version v0.47.2 running on windows
hover: Sharing packaging tools
hover: darwin-bundle is supported
hover: Packaging darwin-dmg is not supported on windows
hover: To still package darwin-dmg on windows you need to run hover with the `--docker` flag.
hover: Packaging darwin-pkg is not supported on windows
hover: To still package darwin-pkg on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-appimage is not supported on windows
hover: To still package linux-appimage on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-deb is not supported on windows
hover: To still package linux-deb on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-pkg is not supported on windows
hover: To still package linux-pkg on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-rpm is not supported on windows
hover: To still package linux-rpm on windows you need to run hover with the `--docker` flag.
hover: Packaging linux-snap is not supported on windows
hover: To still package linux-snap on windows you need to run hover with the `--docker` flag.
hover: To package windows-msi these tools are required: candle
hover: Install the WiX Toolset from https://wixtoolset.org/releases/
hover: To still package windows-msi without the required tools installed you need to run hover with the `--docker` flag.
hover:
hover: Sharing flutter version
Flutter 3.7.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 12cb4eb7a0 (3 days ago) • 2023-03-01 10:29:26 -0800
Engine • revision ada363ee93
Tools • Dart 2.19.3 • DevTools 2.20.1
hover: Flutter engine commit: https://github.com/flutter/engine/commit/ada363ee93b17cfe31587b5102679885cb40837e
hover: ⚠ The go-flutter project tries to stay compatible with the beta channel of Flutter.
hover: ⚠     It's advised to use the beta channel: `flutter channel beta`
hover: Finding out the C compiler version
gcc (tdm64-1) 5.1.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hover: Sharing the content of go.mod
module stocks/go

go 1.19

require (
        github.com/go-flutter-desktop/go-flutter v0.52.2
        github.com/pkg/errors v0.9.1
)

require (
        github.com/Xuanwo/go-locale v1.1.0 // indirect
        github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect
        github.com/go-gl/glfw/v3.3/glfw v0.0.0-20220712193148-63cf1f4ef61f // indirect
        golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b // indirect
        golang.org/x/text v0.3.7 // indirect
)
hover: Sharing the content of hover.yaml
application-name: ""
executable-name: ""
package-name: ""
organization-name: ""
license: ""
target: lib/main_desktop.dart
branch: ""
cache-path: ""
opengl: ""
engine-version: ""
hover: Sharing the content of go/cmd
go\cmd\main.go  go\cmd\options.go

D:\source\repos\dart_solutions\tutorial_sample\examples\stocks>

Error output

Using hover run to build your application, I get the following error:

D:\source\repos\dart_solutions\tutorial_sample\examples\stocks>hover run
hover: Missing/Empty `version` field in pubspec.yaml. Please add it or otherwise you may publish your app with a wrong version. Continuing with `0.0.1` as a placeholder version.
hover: Using engine from cache
hover: Cleaning the build directory
hover: listing available plugins:
hover: ⚠ The go-flutter project tries to stay compatible with the beta channel of Flutter.
hover: ⚠     It's advised to use the beta channel: `flutter channel beta`
hover: Bundling flutter app

 Building with sound null safety

lib/stock_settings.dart:75:21: Error: Couldn't find constructor 'FlatButton'.
                new FlatButton(
                    ^^^^^^^^^^
lib/stock_settings.dart:81:21: Error: Couldn't find constructor 'FlatButton'.
                new FlatButton(
                    ^^^^^^^^^^
lib/stock_home.dart:26:13: Error: Couldn't find constructor 'FlatButton'.
        new FlatButton(
            ^^^^^^^^^^
lib/stock_home.dart:41:13: Error: Couldn't find constructor 'FlatButton'.
        new FlatButton(
            ^^^^^^^^^^
lib/stock_home.dart:247:31: Error: The method 'showSnackBar' isn't defined for the class 'ScaffoldState'.
 - 'ScaffoldState' is from 'package:flutter/src/material/scaffold.dart' ('/C:/Program%20Files/flutter/packages/flutter/lib/src/material/scaffold.dart').
Try correcting the name to the name of an existing method, or defining a method named 'showSnackBar'.
    _scaffoldKey.currentState.showSnackBar(new SnackBar(
                              ^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
#0      KernelSnapshot.build (package:flutter_tools/src/build_system/targets/common.dart:246:7)
<asynchronous suspension>
#1      _BuildInstance._invokeInternal (package:flutter_tools/src/build_system/build_system.dart:847:9)
<asynchronous suspension>
#2      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
<asynchronous suspension>
#3      _BuildInstance.invokeTarget (package:flutter_tools/src/build_system/build_system.dart:785:32)
<asynchronous suspension>
#4      FlutterBuildSystem.build (package:flutter_tools/src/build_system/build_system.dart:614:16)
<asynchronous suspension>
#5      BundleBuilder.build (package:flutter_tools/src/bundle_builder.dart:75:32)
<asynchronous suspension>
#6      BuildBundleCommand.runCommand (package:flutter_tools/src/commands/build_bundle.dart:138:5)
<asynchronous suspension>
#7      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
<asynchronous suspension>
#8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
<asynchronous suspension>
#11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#12     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#13     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
<asynchronous suspension>
#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#15     main (package:flutter_tools/executable.dart:91:3)
<asynchronous suspension>

Failed to build bundle.
hover: Flutter build failed: exit status 1

Error screenshots

изображение изображение

pchampio commented 1 year ago

Our demo was build before flutter 2.0, the error you are seeing is related to this, the FlatButton (or the way we import it) might be deprecated. This is an error from the flutter framework that can be fixed by updating our demo Dart code to the new flutter 2.0 frw. I dont have any time at the moment for this, but if you know flutter, and have some, you can easily fix this.

lkhorasandzhian commented 1 year ago

Appreciate it!