ros2dart / dartros1

A ROS1 client library for dart
Apache License 2.0
20 stars 11 forks source link

Migrate to null-safety #8

Closed TimWhiting closed 3 years ago

TimWhiting commented 4 years ago

I've been watching the progress on dart's null safety. My opinion is that we migrate as soon as possible. But I should probably wait for some of the dependencies to be migrated first in case their apis change as a result of migrating.

Here is the output of pub outdated --mode=null-safety as of Nov 19th: There are a few dependencies that I could probably get rid of, and eventually I'll have to update the code generation for messages. So it will probably be at least a little while.

Showing dependencies that are currently not opted in to null-safety.
[✗] indicates versions without null safety support.
[✓] indicates versions opting in to null safety.

Package Name        Current   Upgradable  Resolvable  Latest                 

direct dependencies:
actionlib_msgs      ✗0.0.3    ✗0.0.3      -           ✗0.0.3                 
buffer              ✗1.0.7    ✗1.0.7      -           ✓1.1.0-nullsafety.0    
collection          ✗1.14.13  ✗1.14.13    -           ✓1.15.0-nullsafety.5   
dartx               ✗0.5.0    ✗0.5.0      -           ✗0.5.0                 
freezed_annotation  ✗0.12.0   ✗0.12.0     -           ✗0.12.0                
http                ✗0.12.2   ✗0.12.2     -           ✗0.12.2                
logger              ✗0.9.4    ✗0.9.4      -           ✓1.0.0-nullsafety.0    
meta                ✗1.2.4    ✗1.2.4      -           ✓1.3.0-nullsafety.6    
path                ✗1.7.0    ✗1.7.0      -           ✓1.8.0-nullsafety.3    
rosgraph_msgs       ✗0.0.3    ✗0.0.3      -           ✗0.0.3                 
rxdart              ✗0.25.0   ✗0.25.0     -           ✓0.26.0-nullsafety.1   
std_msgs            ✗0.0.3    ✗0.0.3      -           ✗0.0.3                 
string_validator    ✗0.1.4    ✗0.1.4      -           ✓0.2.0-nullsafety.0    
xml                 ✗4.5.1    ✗4.5.1      -           ✓5.0.0-nullsafety.1    
xml_rpc             ✗0.3.0    ✗0.3.0      -           ✗0.3.0                 

dev_dependencies:  
abide               ✗1.6.4    ✗1.6.4      -           ✗1.6.4                 
async               ✗2.4.2    ✗2.4.2      -           ✓2.5.0-nullsafety.3    
build_runner        ✗1.10.11  ✗1.10.13    -           ✗1.10.13               
derry               ✗1.1.1    ✗1.2.1      -           ✗1.2.1                 
freezed             ✗0.12.6   ✗0.12.7     -           ✗0.12.7                
pedantic            ✗1.9.2    ✗1.9.2      -           ✓1.10.0-nullsafety.3   
sensor_msgs         ✗0.0.3    ✗0.0.3      -           ✗0.0.3                 
test                ✗1.15.7   ✗1.15.7     -           ✓1.16.0-nullsafety.16  

3 upgradable dependencies are locked (in pubspec.lock) to older versions.
To update these dependencies, use `pub upgrade`.
TimWhiting commented 3 years ago

Hi @knuesel

I've migrated to nullsafety on a branch of this repository and the gendart repository. I've tested it out with the simple examples in our tests & your simple action in test_dart. However, I'm not super confident about the actions migration since I don't use actions much.

If you could test it out and make sure everything is working that would be great!

I waited for everything except the dartx dependency to migrate since I'm fairly confident an update in dartx will have very little effect on nullsafety in this package. Until dartx gets the null safe version published you have to run in not sound nullsafety mode.

e.g. dart --no-sound-null-safety test.

I'll wait to close this issue until its been more thoroughly tested. However prerelease versions of dartros and the message packages are already published to pub.dev.

knuesel commented 3 years ago

Nice work! I could migrate my (very small) code without issue.

knuesel commented 3 years ago

Now that dartx has migrated, do you think this can be merged in master?

TimWhiting commented 3 years ago

I'm working on migrating some of our code to use the null-safe dartros, technically I think we could use the null-safe version even without migrating our own code, but because of some dependency conflicts it would mean that I would have to have a ton of dependency_overrides. Until I have that finalized I'm going to keep null-safety in a separate branch, but I'll publish a null-safe stable release to pub with the latest dartx.

TimWhiting commented 3 years ago

Currently blocked on null-safe stable releases of buffer, logger and string_validator, I'll probably drop the string_validator dependency, but I'll submit an issue on the other repositories.

TimWhiting commented 3 years ago

Stable null-safe version published as 0.1.0. Leaving this issue open for tracking merging into master once I update our code that uses it, in case I need to patch anything on the old version if we run into issues.