Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 27f5cba

Browse files
authored
[multiple] Remove custom analysis_options.yaml from web plugins. (#3238)
Substitute `undefined_prefixed_name: ignore` custom analyzer setting by a `dart:ui` shim with conditional exports for the following plugins: * video_player_web * google_maps_flutter_web * url_launcher_web Remove these plugins from the CUSTOM_ANALYSIS_PLUGINS list in `script/incremental_build.sh`
1 parent c7062dc commit 27f5cba

22 files changed

+147
-43
lines changed

packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.0+7
2+
3+
* Substitute `undefined_prefixed_name: ignore` analyzer setting by a `dart:ui` shim with conditional exports. [Issue](https://github.com/flutter/flutter/issues/69309).
4+
15
## 0.1.0+6
26

37
* Ensure a single `InfoWindow` is shown at a time. [Issue](https://github.com/flutter/flutter/issues/67380).

packages/google_maps_flutter/google_maps_flutter_web/analysis_options.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/google_maps_flutter/google_maps_flutter_web/lib/google_maps_flutter_web.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ library google_maps_flutter_web;
66

77
import 'dart:async';
88
import 'dart:html';
9-
import 'dart:ui' as ui;
9+
import 'src/shims/dart_ui.dart' as ui; // Conditionally imports dart:ui in web
1010
import 'dart:convert';
1111

1212
import 'package:flutter/rendering.dart';
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
/// This file shims dart:ui in web-only scenarios, getting rid of the need to
6+
/// suppress analyzer warnings.
7+
8+
// TODO(flutter/flutter#55000) Remove this file once web-only dart:ui APIs
9+
// are exposed from a dedicated place.
10+
export 'dart_ui_fake.dart' if (dart.library.html) 'dart_ui_real.dart';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:html' as html;
6+
7+
// Fake interface for the logic that this package needs from (web-only) dart:ui.
8+
// This is conditionally exported so the analyzer sees these methods as available.
9+
10+
/// Shim for web_ui engine.PlatformViewRegistry
11+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L62
12+
class platformViewRegistry {
13+
/// Shim for registerViewFactory
14+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L72
15+
static registerViewFactory(
16+
String viewTypeId, html.Element Function(int viewId) viewFactory) {}
17+
}
18+
19+
/// Shim for web_ui engine.AssetManager.
20+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L12
21+
class webOnlyAssetManager {
22+
/// Shim for getAssetUrl.
23+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L45
24+
static getAssetUrl(String asset) {}
25+
}
26+
27+
/// Signature of callbacks that have no arguments and return no data.
28+
typedef VoidCallback = void Function();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
export 'dart:ui';

packages/google_maps_flutter/google_maps_flutter_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: google_maps_flutter_web
22
description: Web platform implementation of google_maps_flutter
33
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
4-
version: 0.1.0+6
4+
version: 0.1.0+7
55

66
flutter:
77
plugin:

packages/url_launcher/url_launcher_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.1.5+1
2+
3+
- Substitute `undefined_prefixed_name: ignore` analyzer setting by a `dart:ui` shim with conditional exports. [Issue](https://github.com/flutter/flutter/issues/69309).
4+
15
# 0.1.5
26

37
- Added the web implementation of the Link widget.

packages/url_launcher/url_launcher_web/analysis_options.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
/// This file shims dart:ui in web-only scenarios, getting rid of the need to
6+
/// suppress analyzer warnings.
7+
8+
// TODO(flutter/flutter#55000) Remove this file once web-only dart:ui APIs
9+
// are exposed from a dedicated place.
10+
export 'dart_ui_fake.dart' if (dart.library.html) 'dart_ui_real.dart';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:html' as html;
6+
7+
// Fake interface for the logic that this package needs from (web-only) dart:ui.
8+
// This is conditionally exported so the analyzer sees these methods as available.
9+
10+
/// Shim for web_ui engine.PlatformViewRegistry
11+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L62
12+
class platformViewRegistry {
13+
/// Shim for registerViewFactory
14+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L72
15+
static registerViewFactory(
16+
String viewTypeId, html.Element Function(int viewId) viewFactory) {}
17+
}
18+
19+
/// Shim for web_ui engine.AssetManager.
20+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L12
21+
class webOnlyAssetManager {
22+
/// Shim for getAssetUrl.
23+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L45
24+
static getAssetUrl(String asset) {}
25+
}
26+
27+
/// Signature of callbacks that have no arguments and return no data.
28+
typedef VoidCallback = void Function();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
export 'dart:ui';

packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
import 'dart:async';
66
import 'dart:html' as html;
7-
// ignore: undefined_shown_name
8-
import 'dart:ui' as ui show platformViewRegistry;
7+
import 'src/shims/dart_ui.dart' as ui;
98

109
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
1110
import 'package:meta/meta.dart';

packages/url_launcher/url_launcher_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/url_launcher/u
44
# 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump
55
# the version to 2.0.0.
66
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7-
version: 0.1.5
7+
version: 0.1.5+1
88

99
flutter:
1010
plugin:

packages/video_player/video_player_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.4+1
2+
3+
* Substitute `undefined_prefixed_name: ignore` analyzer setting by a `dart:ui` shim with conditional exports. [Issue](https://github.com/flutter/flutter/issues/69309).
4+
15
## 0.1.4
26

37
* Added option to set the video playback speed on the video controller.

packages/video_player/video_player_web/analysis_options.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
/// This file shims dart:ui in web-only scenarios, getting rid of the need to
6+
/// suppress analyzer warnings.
7+
8+
// TODO(flutter/flutter#55000) Remove this file once web-only dart:ui APIs
9+
// are exposed from a dedicated place.
10+
export 'dart_ui_fake.dart' if (dart.library.html) 'dart_ui_real.dart';
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:html' as html;
6+
7+
// Fake interface for the logic that this package needs from (web-only) dart:ui.
8+
// This is conditionally exported so the analyzer sees these methods as available.
9+
10+
/// Shim for web_ui engine.PlatformViewRegistry
11+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L62
12+
class platformViewRegistry {
13+
/// Shim for registerViewFactory
14+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/ui.dart#L72
15+
static registerViewFactory(
16+
String viewTypeId, html.Element Function(int viewId) viewFactory) {}
17+
}
18+
19+
/// Shim for web_ui engine.AssetManager.
20+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L12
21+
class webOnlyAssetManager {
22+
/// Shim for getAssetUrl.
23+
/// https://github.com/flutter/engine/blob/master/lib/web_ui/lib/src/engine/assets.dart#L45
24+
static getAssetUrl(String asset) {}
25+
}
26+
27+
/// Signature of callbacks that have no arguments and return no data.
28+
typedef VoidCallback = void Function();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2017 The Chromium Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
export 'dart:ui';

packages/video_player/video_player_web/lib/video_player_web.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:async';
22
import 'dart:html';
3-
import 'dart:ui' as ui;
3+
import 'src/shims/dart_ui.dart' as ui;
44

55
import 'package:flutter/material.dart';
66
import 'package:flutter/services.dart';
@@ -78,8 +78,6 @@ class VideoPlayerPlugin extends VideoPlayerPlatform {
7878
if (dataSource.package != null && dataSource.package.isNotEmpty) {
7979
assetUrl = 'packages/${dataSource.package}/$assetUrl';
8080
}
81-
// 'webOnlyAssetManager' is only in the web version of dart:ui
82-
// ignore: undefined_prefixed_name
8381
assetUrl = ui.webOnlyAssetManager.getAssetUrl(assetUrl);
8482
uri = assetUrl;
8583
break;
@@ -170,7 +168,6 @@ class _VideoPlayer {
170168
videoElement.setAttribute('playsinline', 'true');
171169

172170
// TODO(hterkelsen): Use initialization parameters once they are available
173-
// ignore: undefined_prefixed_name
174171
ui.platformViewRegistry.registerViewFactory(
175172
'videoPlayer-$textureId', (int viewId) => videoElement);
176173

packages/video_player/video_player_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/v
44
# 0.1.y+z is compatible with 1.0.0, if you land a breaking change bump
55
# the version to 2.0.0.
66
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
7-
version: 0.1.4
7+
version: 0.1.4+1
88

99
flutter:
1010
plugin:

script/incremental_build.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ fi
2020
#
2121
# TODO(mklim): Remove everything from this list. https://github.com/flutter/flutter/issues/45440
2222
CUSTOM_ANALYSIS_PLUGINS=(
23-
"video_player/video_player_web"
24-
"google_maps_flutter/google_maps_flutter_web"
25-
"url_launcher/url_launcher_web"
2623
)
2724
# Comma-separated string of the list above
2825
readonly CUSTOM_FLAG=$(IFS=, ; echo "${CUSTOM_ANALYSIS_PLUGINS[*]}")

0 commit comments

Comments
 (0)