Skip to content

Commit

Permalink
Incorporate compat info changes into flutter engine
Browse files Browse the repository at this point in the history
Changes related to compatibility info require changes in
Flutter engine libraries. This CL adds null-asserts wherever
necessary to maintain behavior and adds some small modifications
to handle the change in nullability. Warnings about unnecessary
null assertions are disabled temporarily in this CL as well.

Original issue: dart-lang/sdk#41905
  • Loading branch information
srujzs committed Jul 9, 2020
1 parent d7d390f commit 1b2b00c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/web_ui/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ analyzer:

linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
always_declare_return_types: true
always_put_control_body_on_new_line: true
unnecessary_non_null_assertion: false
# TODO(uncomment) - always_specify_types
# TODO(uncomment) - annotate_overrides
# TODO(uncomment) - avoid_classes_with_only_static_members
Expand Down
6 changes: 3 additions & 3 deletions lib/web_ui/lib/src/engine/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,15 @@ class EngineWindow extends ui.Window {

static List<ui.Locale> parseBrowserLanguages() {
// TODO(yjbanov): find a solution for IE
final bool languagesFeatureMissing = !js_util.hasProperty(html.window.navigator, 'languages');
if (languagesFeatureMissing || html.window.navigator.languages!.isEmpty) {
var languages = html.window.navigator.languages;
if (languages == null || languages.isEmpty) {
// To make it easier for the app code, let's not leave the locales list
// empty. This way there's fewer corner cases for apps to handle.
return const [_defaultLocale];
}

final List<ui.Locale> locales = <ui.Locale>[];
for (final String language in html.window.navigator.languages!) {
for (final String language in languages) {
final List<String> parts = language.split('-');
if (parts.length > 1) {
locales.add(ui.Locale(parts.first, parts.last));
Expand Down

0 comments on commit 1b2b00c

Please sign in to comment.