File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1313// limitations under the License.
1414
1515import 'detected_runtime_stub.dart'
16- if (dart.library.html ) 'detected_runtime_html .dart' ;
16+ if (dart.library.js_interop ) 'detected_runtime_js_interop .dart' ;
1717
1818export 'detected_runtime_stub.dart'
19- if (dart.library.html) 'detected_runtime_html.dart' show detectedRuntime;
19+ if (dart.library.js_interop) 'detected_runtime_js_interop.dart'
20+ show detectedRuntime;
2021
2122/// Return `null` instead of [value] on Firefox.
2223///
Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- // ignore: avoid_web_libraries_in_flutter
16- import 'dart:html' show window;
15+ import 'dart:js_interop' ;
16+
17+ @JS ('window.navigator.userAgent' )
18+ external String get userAgent;
1719
1820/// Detected runtime based on [rendering engine][1] , this is one of:
1921/// * `'firefox'` (if rendering engine is `'gecko'` ),
@@ -32,7 +34,7 @@ import 'dart:html' show window;
3234///
3335/// [1] : https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
3436final String detectedRuntime = () {
35- final ua = window.navigator. userAgent;
37+ final ua = userAgent;
3638
3739 if (ua.contains ('Gecko/' )) {
3840 return 'firefox' ;
You can’t perform that action at this time.
0 commit comments