avirias / Grey

A material designed music player developed in Flutter
MIT License
526 stars 193 forks source link

compile error #2

Closed damulhan closed 4 years ago

damulhan commented 6 years ago

What can I do.

build environments are:

Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git Framework • revision c7ea3ca377 (5 months ago) • 2018-05-29 21:07:33 +0200 Engine • revision 1ed25ca7b7 Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760

compiler message: lib/database/database_client.dart:37:67: Error: Getter not found: 'Columns'.
compiler message:       List<Map> results2 = await _db.query("songs", columns: Song.Columns);
compiler message:                                                                   ^^^^^^^
compiler message: lib/database/database_client.dart:51:18: Error: The getter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'count'.
compiler message:         if (song.count == null) {
compiler message:                  ^
compiler message: lib/database/database_client.dart:52:16: Error: The setter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'count'.
compiler message:           song.count = 0;
compiler message:                ^
compiler message: lib/database/database_client.dart:54:18: Error: The getter 'timestamp' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'timestamp'.
compiler message:         if (song.timestamp == null) {
compiler message:                  ^
compiler message: lib/database/database_client.dart:55:16: Error: The setter 'timestamp' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'timestamp'.
compiler message:           song.timestamp = 0;
compiler message:                ^
compiler message: lib/database/database_client.dart:57:18: Error: The getter 'isFav' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'isFav'.
compiler message:         if (song.isFav == null) {
compiler message:                  ^
compiler message: lib/database/database_client.dart:58:16: Error: The setter 'isFav' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'isFav'.
compiler message:           song.isFav = 0;
compiler message:                ^
compiler message: lib/database/database_client.dart:60:68: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:         if (!songs3.contains(song)) await _db.insert("songs", song.toMap());
compiler message:                                                                    ^
compiler message: lib/database/database_client.dart:69:14: Error: The getter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'count'.
compiler message:     if (song.count == null) {
compiler message:              ^
compiler message: lib/database/database_client.dart:70:12: Error: The setter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'count'.
compiler message:       song.count = 0;
compiler message:            ^
compiler message: lib/database/database_client.dart:72:14: Error: The getter 'timestamp' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'timestamp'.
compiler message:     if (song.timestamp == null) {
compiler message:              ^
compiler message: lib/database/database_client.dart:73:12: Error: The setter 'timestamp' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'timestamp'.
compiler message:       song.timestamp = 0;
compiler message:            ^
compiler message: lib/database/database_client.dart:75:14: Error: The getter 'isFav' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'isFav'.
compiler message:     if (song.isFav == null) {
compiler message:              ^
compiler message: lib/database/database_client.dart:76:12: Error: The setter 'isFav' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'isFav'.
compiler message:       song.isFav = 0;
compiler message:            ^
compiler message: lib/database/database_client.dart:83:43: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:       id = await _db.insert("songs", song.toMap());
compiler message:                                           ^
compiler message: lib/database/database_client.dart:87:33: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:           .update("songs", song.toMap(), where: "id= ?", whereArgs: [song.id]);
compiler message:                                 ^
compiler message: lib/database/database_client.dart:111:48: Error: Getter not found: 'Columns'.
compiler message:         await _db.query("songs", columns: Song.Columns, orderBy: "title");
compiler message:                                                ^^^^^^^
compiler message: lib/database/database_client.dart:203:45: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:       id = await _db.insert("recents", song.toMap());
compiler message:                                             ^
compiler message: lib/database/database_client.dart:206:40: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:       await _db.update("recents", song.toMap(),
compiler message:                                        ^
compiler message: lib/database/database_client.dart:274:43: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:       id = await _db.insert("songs", song.toMap());
compiler message:                                           ^
compiler message: lib/database/database_client.dart:278:33: Error: The method 'toMap' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing method, or defining a method named 'toMap'.
compiler message:           .update("songs", song.toMap(), where: "id= ?", whereArgs: [song.id]);
compiler message:                                 ^
compiler message: lib/musichome.dart:262:18: Error: Method not found: 'CircularNotchedRectangle'.
compiler message:           shape: CircularNotchedRectangle(),
compiler message:                  ^^^^^^^^^^^^^^^^^^^^^^^^
compiler message: lib/musichome.dart:262:11: Error: No named parameter with the name 'shape'.
compiler message:           shape: CircularNotchedRectangle(),
compiler message:           ^^^^^
compiler message: file:///D:/dev/flutter/packages/flutter/lib/src/material/bottom_app_bar.dart:45:9: Context: Found this candidate, but the arguments don't match.
compiler message:   const BottomAppBar({
compiler message:         ^
compiler message: lib/pages/now_playing.dart:126:10: Error: The setter 'timestamp' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'timestamp'.
compiler message:     song.timestamp = new DateTime.now().millisecondsSinceEpoch;
compiler message:          ^
compiler message: lib/pages/now_playing.dart:127:14: Error: The getter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'count'.
compiler message:     if (song.count == null) {
compiler message:              ^
compiler message: lib/pages/now_playing.dart:128:12: Error: The setter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'count'.
compiler message:       song.count = 0;
compiler message:            ^
compiler message: lib/pages/now_playing.dart:130:12: Error: The getter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'count'.
compiler message:       song.count++;
compiler message:            ^
compiler message: lib/pages/now_playing.dart:130:12: Error: The setter 'count' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing setter, or defining a setter or field named 'count'.
compiler message:       song.count++;
compiler message:            ^
compiler message: lib/pages/now_playing.dart:133:18: Error: The getter 'isFav' isn't defined for the class '#lib1::Song'.
compiler message: Try correcting the name to the name of an existing getter, or defining a getter or field named 'isFav'.
compiler message:     isfav = song.isFav;
compiler message:                  ^
Compiler failed on D:\temp\flutter\Grey-0.2.12\lib\main.dart

FAILURE: Build failed with an exception.

* Where:
Script 'D:\dev\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 435

* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command 'D:\dev\flutter\bin\flutter.bat'' 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.

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

BUILD FAILED in 16s
Finished with error: Gradle build failed: 1
avirias commented 6 years ago

first upgrade flutter because of BottomAppBar() class => flutter upgrade and update the song class in plugin

class Song {
  int id;
  String artist;
  String title;
  String album;
  int albumId;
  int duration;
  String uri;
  String albumArt;

  int count = 0;
  int timestamp = 0;
  int isFav = 0;

  Song(this.id, this.artist, this.title, this.album, this.albumId,
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
  static final Columns=["id","artist", "title", "album", "albumId", "duration", "uri", "albumArt","isFav","timestamp"];

  Song.fromMap(Map m) {
    id = m["id"];
    artist = m["artist"];
    title = m["title"];
    album = m["album"];
    albumId = m["albumId"];
    duration = m["duration"];
    uri = m["uri"];
    albumArt = m["albumArt"];
    count = m["count"];
    timestamp = m["timestamp"];
    isFav = m["isFav"];

  }
  Map<String,dynamic> toMap(){
    Map<String,dynamic> map = {
      "id" : id,
      "artist" : artist,
      "title" : title,
      "album" : album,
      "albumId" : albumId,
      "duration" : duration,
      "uri" : uri,
      "albumArt" : albumArt,
      "count" : count,
      "timestamp" : timestamp,
      "isFav" : isFav
  };
    return map;
  }
}
permanar commented 5 years ago

Hi @avirias , I have same issue with this but a little bit different showed error log. What should I do? My environment is: Flutter 1.0.0 • channel beta • https://github.com/flutter/flutter.git Framework • revision 5391447fae (5 days ago) • 2018-11-29 19:41:26 -0800 Engine • revision 7375a0f414 Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

The problem is every time I run flutter run it always showed me error like this:

Compiler message:
lib/views/songs.dart:37:3: Error: The name of a constructor must match the name of the enclosing class.
  Song.fromMap(Map m) {
  ^^^^
package:musicplayer/views/songs.dart:1: Context: The name of the enclosing class is 'Songs'.
lib/views/songs.dart:10:7: Error: The non-abstract class 'Songs' is missing implementations for these members:
  'Song', 'createState'.
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class Songs extends StatefulWidget {
      ^^^^^
lib/views/songs.dart:32:3: Context: 'Song' is defined here.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
  ^^^^
file:///D:/flutter/packages/flutter/lib/src/widgets/framework.dart:1: Context: 'createState' is defined here.
lib/musichome.dart:27:16: Error: Method not found: 'Songs'.
        return Songs(db);
               ^^^^^
lib/views/songs.dart:32:8: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
       ^^^^
lib/views/songs.dart:32:17: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
                ^^^^
lib/views/songs.dart:32:30: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
                             ^^^^
lib/views/songs.dart:32:42: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
                                         ^^^^
lib/views/songs.dart:32:54: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
  Song(this.id, this.artist, this.title, this.album, this.albumId,
                                                     ^^^^
lib/views/songs.dart:33:7: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
      ^^^^
lib/views/songs.dart:33:22: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
                     ^^^^
lib/views/songs.dart:33:32: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
                               ^^^^
lib/views/songs.dart:33:47: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
                                              ^^^^
lib/views/songs.dart:33:60: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
                                                           ^^^^
lib/views/songs.dart:33:77: Error: Field formal parameters can only be used in a constructor.
Try removing 'this.'.
      this.duration, this.uri, this.albumArt,{this.isFav=0,this.timestamp=0,this.count=0});
                                                                            ^^^^
lib/views/songs.dart:82:26: Error: The getter 'db' isn't defined for the class '#lib1::Songs'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'db'.
    songs = await widget.db.fetchSongs();
                         ^^
lib/views/songs.dart:131:48: Error: The getter 'db' isn't defined for the class '#lib1::Songs'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'db'.
                                        widget.db, MyQueue.songs, i, 0)));
                                               ^^
Compiler failed on D:\Code\Flutter\Grey-master\lib/main.dart
Gradle task 'assembleDebug'... Done                          9.7s
Gradle task assembleDebug failed with exit code 1
avirias commented 4 years ago

run flutter package upgrade