tekartik / midi.dart

Library for manipulating and sequencing Midi files, tracks, events
BSD 2-Clause "Simplified" License
35 stars 6 forks source link

Due to version incompatibility, midi is parsed,How to solve #37

Open TIMEMECHINEOO opened 1 month ago

TIMEMECHINEOO commented 1 month ago

The current Dart SDK version is 3.5.3.

Because flutter_midi_text depends on dependencies any which doesn't support null safety, version solving failed.

The lower bound of "sdk: '>=2.0.0 <3.0.0'" must be 2.12.0 or higher to enable null safety. For details, see https://dart.dev/null-safety

alextekartik commented 1 month ago

Can you share how you setup your dependency? My guess is that the ref you specified in you pubspec is old (dart2). You should switch to ref dart3a:

See the setup here https://github.com/tekartik/midi.dart?tab=readme-ov-file#setup and information about versioning

TIMEMECHINEOO commented 1 month ago

name: flutter_midi_text description: "A new Flutter project." publish_to: 'none' version: 0.1.0

environment: sdk: ^3.5.3

dependencies: flutter: sdk: flutter

dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 dependencies: tekartik_midi: path: /Users/Developer/midi.dart

flutter: uses-material-design: true

name: tekartik_midi version: 0.4.1 description: midi event and file parser publish_to: none

environment: sdk: ^3.5.3 dependencies: collection: ^1.15.0 tekartik_common_utils: git: url: https://github.com/tekartik/common_utils.dart ref: dart3a version: '>=0.10.7'

dev_dependencies: test: ^1.21.0 path: ^1.8.0 build_runner: '>=0.9.0' build_test: '>=0.10.2' process_run: '>=0.10.2' dev_build: '>0.13.1+1' build_web_compilers: '>=0.4.0'

I used git at first, but then because errors kept getting reported at the reference point, I changed it to local reference. I also updated all flutter and dart. I also checked the branch and it is applicable, but I couldn’t find the problem.And when quoting git, I will be prompted that your dependent packages and project names cannot be repeated. After I change it, other problems will occur.

alextekartik commented 1 month ago

Can you try using:

dependencies:
  tekartik_midi:
    git:
      url: https://github.com/tekartik/midi.dart
      ref: dart3a
TIMEMECHINEOO commented 1 month ago

I tried it. When I put the dart files under flutter, a lot of red wavy prompts will appear. I don't understand why. Even if I install the dependencies, it still can't be solved. errors like these, it has146 lines. The name 'MidiEvent' is defined in the libraries 'file:///Users/Developer/TEST/flutter_midi_text/lib/src/midi/event.dart' and 'file:///Users/Developer/midi.dart/lib/src/midi/event.dart (via file:///Users/Developer/TEST/flutter_midi_text/lib/midi.dart)'. Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.

alextekartik commented 1 month ago

It seems you have duplicated code. Try deleting duplicated files that you have copied (such as src/midi/event.dart and just include the git dependency and fix your import

TIMEMECHINEOO commented 1 month ago

Thank you for your answer, I have solved the problem, the dependency was misplaced and the corresponding dart reference was missing before: dependencies: flutter: sdk: flutter

dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0 dependencies: tekartik_midi: path: /Users/Developer/midi.dart

after: dependencies: flutter: sdk: flutter tekartik_midi: git: url: https://github.com/tekartik/midi.dart ref: dart3a

dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^4.0.0