Skip to content
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

Migrate to Flutter 2 #370

Merged

Conversation

Jeasmine
Copy link
Contributor

@Jeasmine Jeasmine commented Mar 25, 2021

  • Add Null safety support

This change is Reviewable

@Jeasmine Jeasmine added the WIP Work In Progress label Mar 25, 2021
@Jeasmine Jeasmine changed the title Migrate to Flutter 2 WIP - Migrate to Flutter 2 Mar 25, 2021
@Jeasmine Jeasmine force-pushed the improvement/update-to-null-safety-support branch 2 times, most recently from 4f2410f to 86b9900 Compare March 25, 2021 19:39
@Jeasmine Jeasmine changed the title WIP - Migrate to Flutter 2 Migrate to Flutter 2 Mar 25, 2021
@Jeasmine Jeasmine removed the WIP Work In Progress label Mar 25, 2021
@Jeasmine Jeasmine requested a review from jkasten2 March 25, 2021 20:01
@Jeasmine Jeasmine force-pushed the improvement/update-to-null-safety-support branch 2 times, most recently from 664afe8 to ef75a67 Compare March 25, 2021 20:13
* Add Null safety support
@Jeasmine Jeasmine force-pushed the improvement/update-to-null-safety-support branch from ef75a67 to 6137aca Compare March 25, 2021 20:28
@Jeasmine Jeasmine requested a review from emawby March 26, 2021 21:00
@hienlh hienlh mentioned this pull request Mar 27, 2021
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 18 of 18 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @emawby and @Jeasmine)


example/lib/main.dart, line 292 at r1 (raw file):

    // Get the value for a trigger by its key
    Object? triggerValue = await OneSignal.shared.getTriggerValueForKey("trigger_3");
    print("'trigger_3' key trigger value: ${triggerValue?.toString() ?? null}");

?? null doesn't seems needed here. Doesn't triggerValue?.toString() result in null if triggerValue is null?


lib/src/create_notification.dart, line 176 at r1 (raw file):

    if (this.buttons != null) {
      var btns = [];
      this.buttons!.forEach((btn) => btns.add(btn.mapRepresentation()));

Is the ! needed here? Does Dart not infer that it can't be null from the if block it is contained in?

Copy link
Contributor Author

@Jeasmine Jeasmine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @emawby and @jkasten2)


example/lib/main.dart, line 292 at r1 (raw file):

Previously, jkasten2 (Josh Kasten) wrote…

?? null doesn't seems needed here. Doesn't triggerValue?.toString() result in null if triggerValue is null?

Done.


lib/src/create_notification.dart, line 176 at r1 (raw file):

Previously, jkasten2 (Josh Kasten) wrote…

Is the ! needed here? Does Dart not infer that it can't be null from the if block it is contained in?

Actually, it doesn't

Error: Method 'forEach' cannot be called on 'List?' because it is potentially null.

  • 'List' is from 'dart:core'.
  • 'OSActionButton' is from 'package:onesignal_flutter/src/notification.dart' ('../lib/src/notification.dart').
    Try calling using ?. instead.
    this.buttons.forEach((btn) => btns.add(btn.mapRepresentation()));

@Jeasmine Jeasmine requested a review from jkasten2 April 1, 2021 18:59
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @emawby)

@Jeasmine Jeasmine merged commit 586e7e4 into major-release-3.0.0 Apr 5, 2021
@Jeasmine Jeasmine deleted the improvement/update-to-null-safety-support branch April 5, 2021 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants