ibrierley / flutter_map_dragmarker

A drag marker for flutter_map
BSD 3-Clause "New" or "Revised" License
54 stars 37 forks source link

null safety #4

Closed barbalex closed 1 year ago

barbalex commented 3 years ago

Once I know how to include this plugin into my project (https://github.com/ibrierley/flutter_map_dragmarker/issues/3) I will need it to be sound null safe.

As the project is not very big I could give it a go myself. But beware: I am a dart/flutter noob.

@ibrierley What do you think?

ibrierley commented 3 years ago

Let me take a quick look, as I think there's some other dependancies need updating now flutter_map has also, and I'll try and give some feedback how long it will be.

barbalex commented 3 years ago

latlong > latlong2

ibrierley commented 3 years ago

yes, it needs latlong2, which I'll be doing, but there are some other issues too...

ibrierley commented 3 years ago

I'm probably going to run out of time today to upgrade to null safety, there's quite a bit to do, but I will do it in time, hopefully by the end of the weekend.

barbalex commented 3 years ago

Hopefully - but it's your project and you owe me nothing.

ibrierley commented 3 years ago

Hah, no, but I've been putting it off for a while, and I have another plugin which depends on this one.

barbalex commented 3 years ago

Oh, just found flutter_map_line_editor. Looks GREAT!

ibrierley commented 3 years ago

This is the bit that it depends on :D, so that will be done after.

ibrierley commented 3 years ago

Bit of a rush job, but I've created a branch nullsafety if you wanted to test it.

(I haven't had time to do the dragmarket_widget_layer.dart, but the dragmarker.dart normal layer like in the example should work)

barbalex commented 3 years ago

I added this to my pubspec.yaml:

flutter_map_dragmarker:
  git:
    url: https://github.com/ibrierley/flutter_map_dragmarker
    ref: nullsafety

and got:

Because latlong >=0.6.1 depends on logging >=0.11.3 <1.0.0 and latlong <0.6.1 requires SDK version >=1.8.0 <2.0.0, every version of latlong requires logging >=0.11.3 <1.0.0.

And because build_runner >=2.0.0 depends on logging ^1.0.0 and every version of flutter_map_dragmarker from git depends on latlong any, build_runner >=2.0.0 is incompatible with flutter_map_dragmarker from git.
So, because capturing depends on both flutter_map_dragmarker from git and build_runner ^2.0.2, version solving failed.

pub get failed (1; So, because capturing depends on both flutter_map_dragmarker from git and build_runner ^2.0.2, version solving failed.)
exit code 1

So latlong needs to be replaced with latlong2.

ibrierley commented 3 years ago

Think a pubspec didn't update, try now.

Ian

On Thu, Jun 10, 2021 at 8:29 PM Alexander Gabriel @.***> wrote:

I added this to my pubspec.yaml:

flutter_map_dragmarker: git: url: https://github.com/ibrierley/flutter_map_dragmarker ref: nullsafety

and got:

Because latlong >=0.6.1 depends on logging >=0.11.3 <1.0.0 and latlong <0.6.1 requires SDK version >=1.8.0 <2.0.0, every version of latlong requires logging >=0.11.3 <1.0.0.

And because build_runner >=2.0.0 depends on logging ^1.0.0 and every version of flutter_map_dragmarker from git depends on latlong any, build_runner >=2.0.0 is incompatible with flutter_map_dragmarker from git. So, because capturing depends on both flutter_map_dragmarker from git and build_runner ^2.0.2, version solving failed.

pub get failed (1; So, because capturing depends on both flutter_map_dragmarker from git and build_runner ^2.0.2, version solving failed.) exit code 1

So latlong needs to be replaced with latlong2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ibrierley/flutter_map_dragmarker/issues/4#issuecomment-858956840, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5YN5PGABKEFWFHHEQHWLLTSEHBLANCNFSM46ORRNMQ .

barbalex commented 3 years ago

Same result.

Seems that latlong still did not get updated: https://github.com/ibrierley/flutter_map_dragmarker/blob/nullsafety/pubspec.yaml#L30

barbalex commented 3 years ago

actually, slightly different result:

[capturing] flutter pub get
Running "flutter pub get" in capturing...                       
Because every version of flutter_map_dragmarker from git depends on latlong 0.8.0 which doesn't match any versions, flutter_map_dragmarker from git is forbidden.

So, because capturing depends on flutter_map_dragmarker from git, version solving failed.
pub get failed (1; So, because capturing depends on flutter_map_dragmarker from git, version solving failed.)
exit code 1
barbalex commented 3 years ago

Seems that you updated the version to 0.8.0 which is correct for latlong2 but forgot to change latlong to latlong2.

Also, don't forget to update the imports:

import 'package:latlong2/latlong.dart';

instead of:

import 'package:latlong/latlong.dart';
barbalex commented 3 years ago

Oh, you did update the imports: https://github.com/ibrierley/flutter_map_dragmarker/blob/nullsafety/lib/dragmarker.dart#L4

ibrierley commented 3 years ago

Yes, I think it's because I've got 2 slightly different versions I'm switching between...can you try again.

barbalex commented 3 years ago

Installs now. I'll try to implement it and see if I get it to work now.

barbalex commented 3 years ago

When launching the virtual device I get:

Launching lib\main.dart on sdk gphone x86 64 in debug mode...
lib\main.dart:1
../flutter/.pub-cache/git/flutter_map_dragmarker-e3747e9aa0594e2881ce2b3db197e1bdd9012bc9/lib/dragmarker.dart:65:67: Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.12 or higher.
  DragMarkerWidget({this.mapState, required this.marker, AnchorPos? anchorPos, this.stream, this.options }); //: anchor = Anchor.forPos(anchorPos, marker.width, marker.height);                                                          

I am really just guessing, but could this setting be meant? https://github.com/ibrierley/flutter_map_dragmarker/blob/nullsafety/pubspec.yaml#L17

barbalex commented 3 years ago

Yes: https://dart.dev/tools/pub/pubspec#sdk-constraints

barbalex commented 3 years ago

More to the point: https://dart.dev/guides/language/evolution

ibrierley commented 3 years ago

Ok, I've started with a fresh git version pulled from here, so hopefully it will track better. See if this does it.

ibrierley commented 3 years ago

Btw there should be a null safety branch for flutter_map_line_editor, couple of examples and demo gifs on readme if you wanted to try that as well. Thanks for patience.

barbalex commented 3 years ago

Ok, I've started with a fresh git version pulled from here, so hopefully it will track better. See if this does it.

Works fine!

barbalex commented 3 years ago

Btw there should be a null safety branch for flutter_map_line_editor, couple of examples and demo gifs on readme if you wanted to try that as well. Thanks for patience.

I'll leave that for the weekend.

Mmisiek commented 3 years ago

Can you upadate cupertino_icons to 1.0.3 or any on nullsafe branch ?

ibrierley commented 3 years ago

I'm just testing a new branch panfix as there was another issue with flutter_map 0.14 if you wanted to test that.

Mmisiek commented 3 years ago

Sure I can do that.

On Sat, Oct 2, 2021, 07:43 Ian @.***> wrote:

I'm just testing a new branch panfix as there was another issue with flutter_map 0.14 if you wanted to test that.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ibrierley/flutter_map_dragmarker/issues/4#issuecomment-932763762, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABC7O4N2CUBTHJ75FJRBGYDUE4LB7ANCNFSM46ORRNMQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

pablojimpas commented 1 year ago

This is not a problem any more. This package is compatible with full sound null safety, and therefore Dart 3 and Flutter 3.10. Closing…