diff --git a/ngcompiler/lib/v1/src/compiler/template_parser/ast_template_parser.dart b/ngcompiler/lib/v1/src/compiler/template_parser/ast_template_parser.dart index 7ce71272bb..ebaa0fa38a 100644 --- a/ngcompiler/lib/v1/src/compiler/template_parser/ast_template_parser.dart +++ b/ngcompiler/lib/v1/src/compiler/template_parser/ast_template_parser.dart @@ -1190,8 +1190,7 @@ String _getEventName(ast.EventAst event) => /// Visitor which filters elements that are not supported in angular templates. class _ElementFilter extends ast.RecursiveTemplateAstVisitor { - static const _securityUrl = - 'https://webdev.dartlang.org/angular/guide/security'; + static const _securityUrl = 'https://angulardart.xyz/guide/security'; @override ast.ElementAst? visitElement(ast.ElementAst astNode, [_]) { diff --git a/ngdart/lib/angular.dart b/ngdart/lib/angular.dart index 297f37b162..b85e5313cd 100644 --- a/ngdart/lib/angular.dart +++ b/ngdart/lib/angular.dart @@ -11,9 +11,9 @@ /// * [AngularDart guide][] /// * [AngularDart cheat sheet][cheatsheet] /// -/// [AngularDart]: https://webdev.dartlang.org/angular -/// [AngularDart guide]: https://webdev.dartlang.org/angular/guide -/// [cheatsheet]: https://webdev.dartlang.org/angular/cheatsheet +/// [AngularDart]: https://angulardart.xyz +/// [AngularDart guide]: https://angulardart.xyz/guide +/// [cheatsheet]: https://angulardart.xyz/cheatsheet library; diff --git a/ngdart/lib/experimental.dart b/ngdart/lib/experimental.dart index 4e3a37bff8..0502c0b37d 100644 --- a/ngdart/lib/experimental.dart +++ b/ngdart/lib/experimental.dart @@ -24,7 +24,7 @@ export 'src/meta.dart' show changeDetectionLink; /// /// Requires [userInjector] to provide app-level services or overrides: /// ```dart -/// main() { +/// void main() { /// var injector = rootInjector((parent) { /// return Injector.map({ /* ... */ }, parent); /// }); diff --git a/ngdart/lib/src/bootstrap/run.dart b/ngdart/lib/src/bootstrap/run.dart index b5379cfc50..2474300644 100644 --- a/ngdart/lib/src/bootstrap/run.dart +++ b/ngdart/lib/src/bootstrap/run.dart @@ -69,7 +69,7 @@ Injector appInjector( /// An implementation of [Injector] that invokes closures. /// /// ... right now this is a workaround for the ApplicationRef issue above. -@Immutable() +@immutable class _LazyInjector extends HierarchicalInjector { final Map _providers; @@ -99,8 +99,8 @@ Injector _identityInjector(Injector parent) => parent; /// Starts a new AngularDart application with [componentFactory] as the root. /// /// ```dart -/// // Assume this file is "main.dart". /// import 'package:ngdart/angular.dart'; +/// /// import 'main.template.dart' as ng; /// /// @Component( @@ -123,8 +123,9 @@ Injector _identityInjector(Injector parent) => parent; /// Optionally may supply a [createInjector] function in order to provide /// services to the root of the application: /// -/// // Assume this file is "main.dart". +/// ```dart /// import 'package:ngdart/angular.dart'; +/// /// import 'main.template.dart' as ng; /// /// @Component( @@ -143,14 +144,14 @@ Injector _identityInjector(Injector parent) => parent; /// } /// } /// -/// void main() { -/// runApp(ng.HelloWorldNgFactory, createInjector: helloInjector); -/// } -/// /// @GenerateInjector(const [ -/// const ClassProvider(HelloService), +/// const ClassProvider(HelloService) /// ]) /// final InjectorFactory helloInjector = ng.helloInjector$Injector; +/// +/// void main() { +/// runApp(ng.HelloWorldNgFactory, createInjector: helloInjector); +/// } /// ``` /// /// See [InjectorFactory] for more examples. diff --git a/ngdart/lib/src/common/directives/ng_class.dart b/ngdart/lib/src/common/directives/ng_class.dart index d9ca821d9a..0f1c8ab8d2 100644 --- a/ngdart/lib/src/common/directives/ng_class.dart +++ b/ngdart/lib/src/common/directives/ng_class.dart @@ -12,14 +12,14 @@ import 'package:web/web.dart'; /// /// - [String] - all the CSS classes listed in a string (space delimited) are /// added -/// - [List] - all the CSS classes (List elements) are added -/// - [Object] - each key corresponds to a CSS class name while values are +/// - [List] - all the CSS classes (List elements) are added +/// - [Map] - each key corresponds to a CSS class name while values are /// interpreted as expressions evaluating to [bool]. If a given expression -/// evaluates to [true] a corresponding CSS class is added - otherwise it is +/// evaluates to `true` a corresponding CSS class is added - otherwise it is /// removed. /// /// While the [NgClass] directive can interpret expressions evaluating to -/// [String], [Array] or [Object], the [Object]-based version is the most often +/// [String], [List] or [Map], the [Map]-based version is the most often /// used and has an advantage of keeping all the CSS class names in a template. /// /// ### Examples @@ -45,8 +45,8 @@ import 'package:web/web.dart'; /// For details, see the [`ngClass` discussion in the Template Syntax][guide] /// page. /// -/// [ex]: https://angulardart.dev/examples/template-syntax#ngClass -/// [guide]: https://webdev.dartlang.org/angular/guide/template-syntax.html#ngClass +/// [ex]: https://angulardart.xyz/examples/template-syntax#ngClass +/// [guide]: https://angulardart.xyz/guide/template-syntax.html#ngClass @Directive( selector: '[ngClass]', ) @@ -144,7 +144,7 @@ class NgClass implements DoCheck, OnDestroy { } /// If [rawClassVal] is an `Iterable`, it should only contain string values, - /// but it is OK if the `Iterable` itself is [Iterable] or + /// but it is OK if the `Iterable` itself is `Iterable` or /// `Iterable` since we need to walk it in this method anyway. /// /// Likewise, if [rawClassVal] is a Map, its keys should all be strings. diff --git a/ngdart/lib/src/common/directives/ng_for.dart b/ngdart/lib/src/common/directives/ng_for.dart index 8bfaab3ac7..a41abeb0d2 100644 --- a/ngdart/lib/src/common/directives/ng_for.dart +++ b/ngdart/lib/src/common/directives/ng_for.dart @@ -81,7 +81,7 @@ import '../../core/linker.dart'; /// For details, see the [`ngFor` discussion in the Template Syntax][guide] /// page. /// -/// [guide]: https://webdev.dartlang.org/angular/guide/template-syntax.html#ngFor +/// [guide]: https://angulardart.xyz/guide/template-syntax.html#ngFor @Directive( selector: '[ngFor][ngForOf]', ) diff --git a/ngdart/lib/src/common/directives/ng_for_identity.dart b/ngdart/lib/src/common/directives/ng_for_identity.dart index fb0c7fc38d..625c5708ec 100644 --- a/ngdart/lib/src/common/directives/ng_for_identity.dart +++ b/ngdart/lib/src/common/directives/ng_for_identity.dart @@ -1,3 +1,6 @@ +/// @docImport 'ng_for.dart'; +library; + import 'package:meta/meta.dart'; import 'package:ngdart/src/core/linker/template_ref.dart'; import 'package:ngdart/src/core/linker/view_container_ref.dart'; @@ -15,8 +18,6 @@ import 'package:ngdart/src/meta.dart'; /// * Uses _identity_ not _contents_ of a collection to build child views. /// * Assumes all collections' contents will never change. /// * Only supports the `$implicit` and `index` local variables. -/// -/// This API is **experimental** and subject to change or removal. @Directive( selector: '[ngForIdentity][ngForIdentityOf]', ) diff --git a/ngdart/lib/src/common/directives/ng_if.dart b/ngdart/lib/src/common/directives/ng_if.dart index 092b9c740d..7f97e67ba6 100644 --- a/ngdart/lib/src/common/directives/ng_if.dart +++ b/ngdart/lib/src/common/directives/ng_if.dart @@ -26,7 +26,7 @@ import 'package:ngdart/src/runtime/check_binding.dart'; /// /// ``` /// -/// [guide]: https://webdev.dartlang.org/angular/guide/template-syntax.html#ngIf +/// [guide]: https://angulardart.xyz/guide/template-syntax.html#ngIf @Directive( selector: '[ngIf]', ) diff --git a/ngdart/lib/src/common/directives/ng_style.dart b/ngdart/lib/src/common/directives/ng_style.dart index 8865999a0f..c2240b93d8 100644 --- a/ngdart/lib/src/common/directives/ng_style.dart +++ b/ngdart/lib/src/common/directives/ng_style.dart @@ -5,9 +5,9 @@ import 'package:web/web.dart'; /// The `NgStyle` directive changes an element's style based on the bound style /// expression: -/// -///
-/// +/// ```html +///
+/// ``` /// _styleExp_ must evaluate to a `Map`. Element style properties /// are set based on the map entries: each _key_:_value_ pair identifies a /// style property _name_ and its _value_. @@ -43,15 +43,8 @@ import 'package:web/web.dart'; /// In this example, user changes to the `` elements result in updates /// to the corresponding style properties of the first paragraph. /// -/// A [Map] literal can be used as a style expression: -/// -///
-/// -/// A better practice, however, is to bind to a component field or method, as -/// in the binding to `setStyle()` above. -/// -/// [guide]: https://webdev.dartlang.org/angular/guide/template-syntax.html#ngStyle -/// [ex]: https://angulardart.dev/examples/template-syntax#ngStyle +/// [guide]: https://angulardart.xyz/guide/template-syntax.html#ngStyle +/// [ex]: https://angulardart.xyz/examples/template-syntax#ngStyle @Directive( selector: '[ngStyle]', ) diff --git a/ngdart/lib/src/common/directives/ng_switch.dart b/ngdart/lib/src/common/directives/ng_switch.dart index 7c1f2d6454..23980b0be1 100644 --- a/ngdart/lib/src/common/directives/ng_switch.dart +++ b/ngdart/lib/src/common/directives/ng_switch.dart @@ -69,8 +69,8 @@ class SwitchView { /// Try the [live example][ex]. /// For details, see the [Structural Directives section on `ngSwitch`][guide]. /// -/// [ex]: https://angulardart.dev/examples/template-syntax#ngSwitch -/// [guide]: https://webdev.dartlang.org/angular/guide/structural-directives.html#ngSwitch +/// [ex]: https://angulardart.xyz/examples/template-syntax#ngSwitch +/// [guide]: https://angulardart.xyz/guide/structural-directives.html#ngSwitch /// @Directive( selector: '[ngSwitch]', diff --git a/ngdart/lib/src/common/pipes/async_pipe.dart b/ngdart/lib/src/common/pipes/async_pipe.dart index 248be633cf..c7aa7fb325 100644 --- a/ngdart/lib/src/common/pipes/async_pipe.dart +++ b/ngdart/lib/src/common/pipes/async_pipe.dart @@ -41,17 +41,19 @@ final _observableStrategy = _ObservableStrategy(); /// /// ```dart /// @Component( -/// selector: 'async-greeter', -/// template: ''' -///
-///

Wait for it ... {{ $pipe.async(greeting) }}

-/// -///
''') +/// selector: 'async-greeter', +/// template: ''' +///
+///

Wait for it ... {{ $pipe.async(greeting) }}

+/// +///
+/// ''', +/// ) /// class AsyncGreeterPipe { /// static const _delay = const Duration(seconds: 2); /// -/// Future greeting; -/// bool done; +/// late Future greeting; +/// late bool done; /// /// AsyncGreeterPipe() { /// tryAgain(); @@ -64,17 +66,17 @@ final _observableStrategy = _ObservableStrategy(); /// /// void tryAgain() { /// done = false; -/// greeting = new Future.delayed(_delay, greet); +/// greeting = Future.delayed(_delay, greet); /// } /// } /// /// @Component( -/// selector: 'async-time', -/// template: "

Time: {{ $pipe.date($pipe.async(time), 'mediumTime') }}

") // +/// selector: 'async-time', +/// template: "

Time: {{ $pipe.date($pipe.async(time), 'mediumTime') }}

", +/// ) /// class AsyncTimePipe { -/// static const _delay = const Duration(seconds: 1); -/// final Stream time = -/// new Stream.periodic(_delay, (_) => new DateTime.now()); +/// static const _delay = Duration(seconds: 1); +/// final Stream time = Stream.periodic(_delay, (_) =>DateTime.now()); /// } /// ``` /// @@ -82,7 +84,7 @@ final _observableStrategy = _ObservableStrategy(); class AsyncPipe implements OnDestroy { Object? _latestValue; Object? _subscription; - dynamic /* Stream | Future | EventEmitter */ _obj; + dynamic /* Stream | Future */ _obj; dynamic _strategy; final ChangeDetectorRef _ref; @@ -95,7 +97,7 @@ class AsyncPipe implements OnDestroy { } } - dynamic transform(dynamic /* Stream | Future | EventEmitter */ obj) { + dynamic transform(dynamic /* Stream | Future */ obj) { if (_obj == null) { if (obj != null) { _subscribe(obj); @@ -107,14 +109,14 @@ class AsyncPipe implements OnDestroy { return _latestValue; } - void _subscribe(dynamic /* Stream | Future | EventEmitter */ obj) { + void _subscribe(dynamic /* Stream | Future */ obj) { _obj = obj; _strategy = _selectStrategy(obj); _subscription = _strategy.createSubscription( obj, (Object? value) => _updateLatestValue(obj, value)); } - dynamic _selectStrategy(dynamic /* Stream | Future | EventEmitter */ obj) { + dynamic _selectStrategy(dynamic /* Stream | Future */ obj) { if (obj is Future) { return _promiseStrategy; } else if (obj is Stream) { diff --git a/ngdart/lib/src/common/pipes/common_pipes.dart b/ngdart/lib/src/common/pipes/common_pipes.dart index 7cb0cf2ebb..ac07a88eea 100644 --- a/ngdart/lib/src/common/pipes/common_pipes.dart +++ b/ngdart/lib/src/common/pipes/common_pipes.dart @@ -11,7 +11,7 @@ import 'uppercase_pipe.dart' show UpperCasePipe; /// This collection can be used to quickly enumerate all the built-in pipes in /// the `pipes` property of the `@Component` annotation. For most applications /// it's recommended to only reference the _exact_ pipes you use, however. -const commonPipes = [ +const List commonPipes = [ AsyncPipe, UpperCasePipe, LowerCasePipe, diff --git a/ngdart/lib/src/common/pipes/date_pipe.dart b/ngdart/lib/src/common/pipes/date_pipe.dart index dd6a215c3f..d925c1286f 100644 --- a/ngdart/lib/src/common/pipes/date_pipe.dart +++ b/ngdart/lib/src/common/pipes/date_pipe.dart @@ -16,9 +16,9 @@ import 'invalid_pipe_argument_exception.dart'; /// in Chrome and Opera browsers. /// /// ## Usage -/// -/// $pipe.date(expression, [format]) -/// +/// ```dart +/// $pipe.date(expression, [format]) +/// ``` /// where `expression` is a date object or a number (milliseconds since UTC /// epoch) and `format` indicates which date/time components to include: /// @@ -62,11 +62,12 @@ import 'invalid_pipe_argument_exception.dart'; /// /// Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, /// second: 11) in the _local_ time and locale is 'en-US': -/// -/// {{ $pipe.date(dateObj) }} // output is 'Jun 15, 2015' -/// {{ $pipe.date(dateObj, 'medium') }} // output is 'Jun 15, 2015, 9:43:11 PM' -/// {{ $pipe.date(dateObj, 'shortTime') }} // output is '9:43 PM' -/// {{ $pipe.date(dateObj, 'mmss') }} // output is '43:11' +/// ```dart +/// {{ $pipe.date(dateObj) }} // output is 'Jun 15, 2015' +/// {{ $pipe.date(dateObj, 'medium') }} // output is 'Jun 15, 2015, 9:43:11 PM' +/// {{ $pipe.date(dateObj, 'shortTime') }} // output is '9:43 PM' +/// {{ $pipe.date(dateObj, 'mmss') }} // output is '43:11' +/// ``` @Pipe('date', pure: true) class DatePipe { static const Map _aliases = { diff --git a/ngdart/lib/src/common/pipes/number_pipe.dart b/ngdart/lib/src/common/pipes/number_pipe.dart index d48da43401..8e320f9cdc 100644 --- a/ngdart/lib/src/common/pipes/number_pipe.dart +++ b/ngdart/lib/src/common/pipes/number_pipe.dart @@ -53,13 +53,13 @@ class _NumberPipe { /// configurations are based on the active locale. /// /// ### Usage -/// -/// $pipe.number(expression, [digitInfo]) -/// +/// ```dart +/// $pipe.number(expression, [digitInfo]) +/// ``` /// where `expression` is a number and `digitInfo` has the following format: -/// -/// {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} -/// +/// ```dart +/// {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} +/// ``` /// - minIntegerDigits is the minimum number of integer digits to use. Defaults to 1. /// - minFractionDigits is the minimum number of digits after fraction. Defaults to 0. /// - maxFractionDigits is the maximum number of digits after fraction. Defaults to 3. @@ -81,9 +81,9 @@ class DecimalPipe extends _NumberPipe { /// Formats a number as local percent. /// /// ### Usage -/// -/// $pipe.percent(expression, [digitInfo]) -/// +/// ```dart +/// $pipe.percent(expression, [digitInfo]) +/// ``` /// For more information about `digitInfo` see [DecimalPipe] @Pipe('percent') class PercentPipe extends _NumberPipe { @@ -100,9 +100,9 @@ class PercentPipe extends _NumberPipe { /// Formats a number as local currency. /// /// ### Usage -/// -/// $pipe.currency(expression, [currencyCode, symbolDisplay, digitInfo]) -/// +/// ```dart +/// $pipe.currency(expression, [currencyCode, symbolDisplay, digitInfo]) +/// ``` /// where `currencyCode` is the ISO 4217 currency code, such as "USD" for the /// US dollar and "EUR" for the euro. `symbolDisplay` is a boolean indicating /// whether to use the currency symbol (e.g. $) or the currency code (e.g. USD) @@ -115,14 +115,15 @@ class CurrencyPipe extends _NumberPipe { String currencyCode = 'USD', bool symbolDisplay = false, String? digits, - ]) => - _NumberPipe._format( - value, - _NumberFormatStyle.currency, - digits, - currencyCode, - symbolDisplay, - ); + ]) { + return _NumberPipe._format( + value, + _NumberFormatStyle.currency, + digits, + currencyCode, + symbolDisplay, + ); + } const CurrencyPipe(); } diff --git a/ngdart/lib/src/common/pipes/replace_pipe.dart b/ngdart/lib/src/common/pipes/replace_pipe.dart index d589a9356d..d640ab4ecc 100644 --- a/ngdart/lib/src/common/pipes/replace_pipe.dart +++ b/ngdart/lib/src/common/pipes/replace_pipe.dart @@ -12,13 +12,13 @@ import 'invalid_pipe_argument_exception.dart' show InvalidPipeArgumentException; /// An optional 'flags' parameter can be set. /// /// ### Usage -/// -/// $pipe.replace(expression, pattern, replacement) -/// +/// ```dart +/// $pipe.replace(expression, pattern, replacement) +/// ``` /// All behavior is based on the expected behavior of the JavaScript API /// String.prototype.replace() function. /// -/// Where the input expression is a [String] or [Number] (to be treated as a +/// Where the input expression is a [String] or [num] (to be treated as a /// string), /// the `pattern` is a [String] or [RegExp], /// the 'replacement' is a [String] or [Function]. diff --git a/ngdart/lib/src/common/pipes/slice_pipe.dart b/ngdart/lib/src/common/pipes/slice_pipe.dart index d77b46f3da..e9b524427f 100644 --- a/ngdart/lib/src/common/pipes/slice_pipe.dart +++ b/ngdart/lib/src/common/pipes/slice_pipe.dart @@ -8,9 +8,9 @@ import 'invalid_pipe_argument_exception.dart' show InvalidPipeArgumentException; /// elements. /// /// ### Usage -/// -/// $pipe.slice(expression, start, [end]) -/// +/// ```dart +/// $pipe.slice(expression, start, [end]) +/// ``` /// The input _expression_ must be a [List] or [String]. /// /// - _start_: the starting index of the subset to return. diff --git a/ngdart/lib/src/core/application_tokens.dart b/ngdart/lib/src/core/application_tokens.dart index b8e73e564c..0cd2df21f1 100644 --- a/ngdart/lib/src/core/application_tokens.dart +++ b/ngdart/lib/src/core/application_tokens.dart @@ -6,11 +6,17 @@ import 'package:ngdart/src/meta.dart'; /// /// To avoid a randomly generated value, a custom value can be provided: /// ```dart -/// bootstrapStatic( -/// YourAppComponent, -/// const [ -/// const Provider(appId, useValue: 'my-unique-id'), -/// ], -/// ) +/// import 'package:ngdart/angular.dart'; +/// +/// import 'main.template.dart' as ng; +/// +/// @GenerateInjector(const [ +/// const ValueProvider.forToken(appId, 'my-unique-id') +/// ]) +/// final InjectorFactory appInjector = appInjector$Injector; +/// +/// void main() { +/// runApp(ng.AppComponentNgFactory, createInjector: appInjector); +/// } /// ``` -const appId = OpaqueToken('appId'); +const OpaqueToken appId = OpaqueToken('appId'); diff --git a/ngdart/lib/src/core/change_detection/change_detector_ref.dart b/ngdart/lib/src/core/change_detection/change_detector_ref.dart index 7c5b584d0c..0df0590bdc 100644 --- a/ngdart/lib/src/core/change_detection/change_detector_ref.dart +++ b/ngdart/lib/src/core/change_detection/change_detector_ref.dart @@ -24,19 +24,19 @@ abstract class ChangeDetectorRef { /// of the component has changed - for example if an async function was /// executed or an observable model has changed: /// - /// ``` + /// ```dart /// @Component( /// selector: 'on-push-example', /// template: 'Number of ticks: {{ticks}}", /// changeDetection: ChangeDetectionStrategy.onPush, /// ) /// class OnPushExample implements OnDestroy { - /// Timer timer; + /// late Timer timer; /// - /// var ticks = 0; + /// int ticks = 0; /// /// OnPushExample(ChangeDetectorRef changeDetector) { - /// timer = Timer.periodic(Duration(seconds: 1), () { + /// timer = Timer.periodic(const Duration(seconds: 1), () { /// ticks++; /// changeDetector.markForCheck(); /// }); @@ -72,7 +72,7 @@ abstract class ChangeDetectorRef { /// knowledge of whether or not [child] is backed by a component using /// `ChangeDetectionStrategy.onPush`. /// - /// ``` + /// ```dart /// @Component( /// selector: 'example', /// template: '', diff --git a/ngdart/lib/src/core/change_detection/differs/default_iterable_differ.dart b/ngdart/lib/src/core/change_detection/differs/default_iterable_differ.dart index ab9e3c0a0a..76d43284dd 100644 --- a/ngdart/lib/src/core/change_detection/differs/default_iterable_differ.dart +++ b/ngdart/lib/src/core/change_detection/differs/default_iterable_differ.dart @@ -10,9 +10,9 @@ import 'package:ngdart/src/utilities.dart'; /// To optimize performance when you have a way to determine uniqueness other /// than identity, such as an `id` field on an object returned from the server, /// you may specify a [TrackByFn]`: -/// ``` +/// ```dart /// class MyComp { -/// Object trackByEmployeeId(int index, dynamic item) { +/// Object? trackByEmployeeId(int index, dynamic item) { /// return item is Employee ? item.id : item; /// } /// } @@ -260,8 +260,6 @@ class DefaultIterableDiffer { /// previousKey to currentKey, and clear all of the queues (additions, moves, /// removals). Set the previousIndexes of moved and added items to their /// currentIndexes. Reset the list of additions, moves and removals - /// - /// @internal void _reset() { if (isDirty) { CollectionChangeRecord? record; @@ -293,8 +291,6 @@ class DefaultIterableDiffer { /// then it is a new item. /// - `item` is the current item in the collection /// - `index` is the position of the item in the collection - /// - /// @internal CollectionChangeRecord _mismatch(CollectionChangeRecord? record, dynamic item, dynamic itemTrackBy, int index) { // The previous record after which we will append the current one. @@ -361,8 +357,6 @@ class DefaultIterableDiffer { /// switching position. This is incorrect, since a better way to think of it /// is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' /// at the end. - /// - /// @internal CollectionChangeRecord _verifyReinsertion(CollectionChangeRecord record, dynamic item, dynamic itemTrackBy, int index) { var reinsertRecord = _unlinkedRecords?.get(itemTrackBy); @@ -379,8 +373,6 @@ class DefaultIterableDiffer { /// collection. /// /// - `record` The first excess [CollectionChangeRecord]. - /// - /// @internal void _truncate(CollectionChangeRecord? record) { // Anything after that needs to be removed; while (record != null) { diff --git a/ngdart/lib/src/core/change_detection/host.dart b/ngdart/lib/src/core/change_detection/host.dart index ede4cea23d..1e432d0349 100644 --- a/ngdart/lib/src/core/change_detection/host.dart +++ b/ngdart/lib/src/core/change_detection/host.dart @@ -20,7 +20,7 @@ abstract class ChangeDetectionHost { /// **INTERNAL ONLY**: Whether a crash was detected during the last `tick()`. static bool get checkForCrashes => _current?._lastGuardedView != null; - /// **INTERNAL ONLY**: Register a crash during [view.detectCrash]. + /// **INTERNAL ONLY**: Register a crash during [View.detectCrash]. static void handleCrash(View view, Object error, StackTrace trace) { final current = _current!; current @@ -42,7 +42,7 @@ abstract class ChangeDetectionHost { StackTrace? _lastCaughtTrace; /// Tracks whether a tick is currently in progress. - var _runningTick = false; + bool _runningTick = false; final List _changeDetectors = []; @@ -94,7 +94,7 @@ abstract class ChangeDetectionHost { } } - /// Runs [AppView.detectChanges] on all top-level components/views. + /// Runs [DeprecatedDetectChanges.detectChanges] on all top-level components/views. void _runTick() { final detectors = _changeDetectors; final length = detectors.length; @@ -111,7 +111,7 @@ abstract class ChangeDetectionHost { } } - /// Runs [AppView.detectChanges] for all top-level components/views. + /// Runs [DeprecatedDetectChanges.detectChanges] for all top-level components/views. /// /// Unlike [_runTick], this enters a guarded mode that checks a view tree for /// exceptions, trying to find the leaf-most node that throws during change @@ -168,7 +168,7 @@ abstract class ChangeDetectionHost { _lastGuardedView = _lastCaughtException = _lastCaughtTrace = null; } - /// Disables the [view] as an error, and forwards to [reportException]. + /// Disables the [view] as an error, and forwards to [handleUncaughtException]. @dart2js.noInline void reportViewException( View view, diff --git a/ngdart/lib/src/core/exception_handler.dart b/ngdart/lib/src/core/exception_handler.dart index 8c73bd25b3..9c0a854324 100644 --- a/ngdart/lib/src/core/exception_handler.dart +++ b/ngdart/lib/src/core/exception_handler.dart @@ -8,28 +8,25 @@ import 'package:web/web.dart'; /// prints the error message directly to the JavaScript developer console. /// /// It's possible to instead write a _custom exception handler_: -/// ``` +/// ```dart /// import 'package:ngdart/angular.dart'; /// /// import 'main.template.dart' as ng; /// /// class MyExceptionHandler implements ExceptionHandler { /// @override -/// void call(exception, [stackTrace, String reason]) { +/// void call(Object exception, [Object? stackTrace, String? reason]) { /// // Do something with this exception, like send to an online service. /// } /// } /// -/// @GenerateInjector([ -/// ClassProvider(ExceptionHandler, useClass: MyExceptionHandler), +/// @GenerateInjector(const [ +/// const ClassProvider(ExceptionHandler, useClass: MyExceptionHandler), /// ]) /// final InjectorFactory appInjector = ng.appInjector$Injector; /// /// void main() { -/// runApp( -/// ng.createMyAppFactory(), -/// createInjector: appInjector, -/// ); +/// runApp(ng.AppNgFactory, createInjector: appInjector); /// } /// ``` class ExceptionHandler { diff --git a/ngdart/lib/src/core/linker/component_factory.dart b/ngdart/lib/src/core/linker/component_factory.dart index 61a0491053..887b875cd0 100644 --- a/ngdart/lib/src/core/linker/component_factory.dart +++ b/ngdart/lib/src/core/linker/component_factory.dart @@ -14,7 +14,7 @@ import 'views/host_view.dart'; /// In practice this can be used to assert that a component does *not* use /// default change detection in non-default or performance sensitive contexts. /// -/// ``` +/// ```dart /// final componentRef = viewContainerRef.createComponent(componentFactory); /// assert(!debugUsesDefaultChangeDetection(componentRef)); /// ``` @@ -115,7 +115,7 @@ class ComponentRef { /// ```dart /// import 'example.template.dart' as ng; /// -/// getComponentFactory() { +/// void getComponentFactory() { /// final ComponentFactory comp = ng.ExampleNgFactory; /// // Can now use 'comp' as a ComponentFactory. /// } diff --git a/ngdart/lib/src/core/linker/component_loader.dart b/ngdart/lib/src/core/linker/component_loader.dart index e755de71fd..b71e621e74 100644 --- a/ngdart/lib/src/core/linker/component_loader.dart +++ b/ngdart/lib/src/core/linker/component_loader.dart @@ -69,7 +69,7 @@ class ComponentLoader { /// ```dart /// @Component( /// selector: 'ad-view', - /// template: r''' + /// template: ''' /// This component is sponsored by: /// /// ''', diff --git a/ngdart/lib/src/core/linker/ng_content_ref.dart b/ngdart/lib/src/core/linker/ng_content_ref.dart index 586b5eb8d1..50b962b0a0 100644 --- a/ngdart/lib/src/core/linker/ng_content_ref.dart +++ b/ngdart/lib/src/core/linker/ng_content_ref.dart @@ -7,7 +7,7 @@ import 'views/render_view.dart'; /// Users can access this class via a direct reference in the template, or a /// view query. /// -/// ``` +/// ```dart /// @Component( /// selector: 'comp', /// template: ''' @@ -19,7 +19,7 @@ import 'views/render_view.dart'; /// ) /// class FooComponent { /// @ViewChild(NgContentRef) -/// NgContentRef child; +/// NgContentRef? child; /// } class NgContentRef { final RenderView _renderView; diff --git a/ngdart/lib/src/core/linker/style_encapsulation.dart b/ngdart/lib/src/core/linker/style_encapsulation.dart index 7aed15df57..5d749ff094 100644 --- a/ngdart/lib/src/core/linker/style_encapsulation.dart +++ b/ngdart/lib/src/core/linker/style_encapsulation.dart @@ -52,7 +52,7 @@ class ComponentStyles { /// `List` or a `String`. While in practice this _is_ possible, the /// current data structure exists in order to optimize for style re-use: /// - /// ``` + /// ```dart /// @Component( /// styleUrls: ['shared.css'], /// ) diff --git a/ngdart/lib/src/core/linker/template_ref.dart b/ngdart/lib/src/core/linker/template_ref.dart index 479baa0abe..f8bd185ac5 100644 --- a/ngdart/lib/src/core/linker/template_ref.dart +++ b/ngdart/lib/src/core/linker/template_ref.dart @@ -12,7 +12,7 @@ import 'views/render_view.dart'; /// `