mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Update Angular embedding sample (#2147)
- Replace `package:js` usage with `dart:js_interop` - Remove and ignore `package-lock.json` since it keeps causing security warnings: https://github.com/flutter/samples/security/dependabot. It's not necessary for this sample and the constraints already present in the `package.json`. - Update to Angular 17.1
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/// Exposes useful functions to interop with JS from our Flutter app.
|
||||
library example_js_interop;
|
||||
library;
|
||||
|
||||
export 'js_interop/counter_state_manager.dart';
|
||||
export 'js_interop/helper.dart' show broadcastAppEvent;
|
||||
|
||||
export 'package:js/js_util.dart' show createDartExport;
|
||||
// Replace with createJSInteropWrapper when updating to Dart 3.3.
|
||||
export 'dart:js_util' show createDartExport;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:js_interop';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:js/js.dart';
|
||||
|
||||
enum DemoScreen {
|
||||
counter('counter'),
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'dart:js_interop';
|
||||
import 'package:js/js.dart';
|
||||
import 'package:js/js_util.dart' as js_util;
|
||||
|
||||
/// This is a little bit of JS-interop code so this Flutter app can dispatch
|
||||
/// a custom JS event (to be deprecated by package:web)
|
||||
library;
|
||||
|
||||
import 'dart:js_interop';
|
||||
|
||||
@JS('CustomEvent')
|
||||
@staticInterop
|
||||
@@ -12,8 +11,7 @@ class DomCustomEvent {
|
||||
external factory DomCustomEvent.withOptions(JSString type, JSAny options);
|
||||
factory DomCustomEvent._(String type, [Object? options]) {
|
||||
if (options != null) {
|
||||
return DomCustomEvent.withOptions(
|
||||
type.toJS, js_util.jsify(options) as JSAny);
|
||||
return DomCustomEvent.withOptions(type.toJS, options.jsify()!);
|
||||
}
|
||||
return DomCustomEvent.withType(type.toJS);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,8 @@ environment:
|
||||
sdk: ^3.2.0
|
||||
|
||||
dependencies:
|
||||
cupertino_icons: ^1.0.2
|
||||
flutter:
|
||||
sdk: flutter
|
||||
js: ^0.7.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user