1
0
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:
Parker Lougheed
2024-01-24 15:53:52 -06:00
committed by GitHub
parent 7dcea5e114
commit 81512c626d
7 changed files with 25 additions and 13791 deletions

View File

@@ -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;

View File

@@ -1,5 +1,6 @@
import 'dart:js_interop';
import 'package:flutter/foundation.dart';
import 'package:js/js.dart';
enum DemoScreen {
counter('counter'),

View File

@@ -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);
}

View File

@@ -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: