-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support null-safety #38
Conversation
@matanlurey Please, can you help me to understand why test are failed? Thanks in advance. |
Hey, Is there any chance of adding null-safety support to this package soon..? |
@leynier , I want to do calculations with converting int to binary, Can you suggest me any package..? |
Hi @Akash9151 sorry for the delay in response, in the meanwhile, you can use the fork made by me.
|
Sorry for the delay, I'm willing to accept this PR or I can fork it and finish it for you @leynier. Feel free to delete the tests that no longer make sense. |
Also add repository property to pubspec.yaml
pedantic is deprecated
I made a few changes like upgrade dependencies, GH Actions, move to another linter package, and other things. The tests run correctly in my fork. |
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 80.91% 85.25% +4.34%
==========================================
Files 7 7
Lines 592 590 -2
==========================================
+ Hits 479 503 +24
+ Misses 113 87 -26
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've manually merged with a few changes.
@alwaysThrows | ||
// ignore: prefer_void_to_null | ||
static Null _max52Bits() { | ||
static void _max52Bits() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The right way to do this is have a return type of Never
- prefer_final_locals | ||
- prefer_void_to_null | ||
- unnecessary_overrides | ||
include: package:lints/recommended.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Thanks. This is actually less strict than the previous settings to a degree.
I've replaced this with package:matan/strict.yaml
.
@@ -9,5 +9,5 @@ extension ObjectX on Object { | |||
/// Casts the current object to type [T]. | |||
/// | |||
/// In some production compilers, this cast is skipped. | |||
T unsafeCast<T>() => this; // ignore: return_of_invalid_type | |||
T unsafeCast<T>() => this as T; // ignore: return_of_invalid_type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Thanks!
To keep this functionality, I needed to add the following pragmas:
@dart2js.tryInline
@pragma('dart2js:as:trust')
@@ -62,7 +62,7 @@ abstract class BitPatternBuilder { | |||
/// | |||
/// print(pattern.match(0xD /* 0b1101 */)); // [1] | |||
/// ``` | |||
BitPattern<List<int>> build([String name]); | |||
BitPattern<List<int>?> build([String? name]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think we don't want a BitPattern
with null
. I've made some changes.
@@ -50,7 +50,7 @@ extension BinaryInt on int { | |||
static const _maxSmiBits = 31; | |||
|
|||
/// Represents `math.pow(2, 32)`, precomputed. | |||
static const _2p32 = 0x100000000; | |||
static const _pow2to32 = 0x100000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Much better!
@@ -0,0 +1,13 @@ | |||
check: get format analyze tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Good idea
Support null-safety
fix: #37
resolve: #39