Skip to content

Apply Flutter best practices [Non-Breaking]#2

Merged
hiroshihorie merged 26 commits intolivekit:mainfrom
unxp:apply-flutter-best-practices
Aug 31, 2021
Merged

Apply Flutter best practices [Non-Breaking]#2
hiroshihorie merged 26 commits intolivekit:mainfrom
unxp:apply-flutter-best-practices

Conversation

@hiroshihorie
Copy link
Copy Markdown
Member

@hiroshihorie hiroshihorie commented Aug 29, 2021

Add flutter_lints package, and clear the lint warnings.
This PR is intended to be non-breaking, but clearing some lint errors need breaking changes, I will open another Draft PR for that.

@hiroshihorie hiroshihorie changed the title Apply flutter best practices Apply Flutter best practices [Non-Breaking] Aug 30, 2021
@hiroshihorie
Copy link
Copy Markdown
Member Author

@davidzhao The tests wont pass because I didn't solve the "Prefer using lowerCamelCase for constant names" lint which requires potentially breaking changes.

@hiroshihorie hiroshihorie requested a review from davidzhao August 31, 2021 04:53
@hiroshihorie hiroshihorie marked this pull request as ready for review August 31, 2021 04:53
@davidzhao
Copy link
Copy Markdown
Member

Ah I see. could we turn off this rule? Some of those we'd probably want to preserve, like RTCIceTransportPolicyAll

Do you have ideas around handling the print violations in example? should we ignore that folder entirely?

@hiroshihorie
Copy link
Copy Markdown
Member Author

hiroshihorie commented Aug 31, 2021

@davidzhao IMO that should be an enum maybe something like:

enum RTCIceTransportPolicy {
  all,
  relay,
}

extension RTCIceTransportPolicyExt on RTCIceTransportPolicy {
  String toStringValue() => {
    RTCIceTransportPolicy.all: 'all',
    RTCIceTransportPolicy.relay: 'relay',
  }[this]!;
}

But that's potentially breaking, I don't see references to RTCIceTransportPolicyAll and RTCIceTransportPolicyRelay as of now tho.

But it's your call 😁

@davidzhao
Copy link
Copy Markdown
Member

that's fair. go ahead and update to your suggestions. Since we haven't officially released it and none of these enums are in the critical path, it's fine to not maintain compatibility.

Copy link
Copy Markdown
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

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

looks good!

@hiroshihorie
Copy link
Copy Markdown
Member Author

I find the 80 chars line length too short for flutter format, can we set it to 120?
dart-lang/dart_style#833

flutter format --set-exit-if-changed -l 120 .

@davidzhao
Copy link
Copy Markdown
Member

I'm ok with relaxing the constraints a bit. But I think 120 is a bit too long. How about 100?

@hiroshihorie
Copy link
Copy Markdown
Member Author

@davidzhao Made minor improvements to the example

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