how to make ngModel works in angulardart? - angular-dart

I am new to angulardart.
The template compiler doesn’t recognize ngModel.
Please help!!
I followed the instruction in angulardart website.
I tried to update pubspec.yaml
but I dont understand this:
{toh-0 → toh-1}/pubspec.yaml
## -8,2 +8,3 ##
8
8
dependencies:
9
9
angular: ^5.3.0
10
+ angular_forms: ^2.1.2
and here is the instruction link:
https://angulardart.dev/tutorial/toh-pt1

Please update your pubspec.yaml according to
https://github.com/angular-examples/toh-1/blob/master/pubspec.yaml
Also add/update the following in your component's dart file.
import 'package:angular_forms/angular_forms.dart';
#Component(
selector: ...,
directives: [formDirectives],
)

Related

Flutter, AmplifyStorageS3 plugin not added correctly

getting
Error :
/*
dynamic AmplifyStorageS3()
package:my_budget_app/main.dart
AmplifyStorageS3 isn't a type.
Try correcting the name to match an existing type
*/
I am following this docs
https://docs.amplify.aws/lib/storage/getting-started/q/platform/flutter/#provision-backend-storage
Amplify storage S3 is not imported correctly.
I cleared cache and reinstalled all the pubs
I deleted publock file and pub get all the files no luck
I restarted vscode a couple of times no luck
I see the import says not used so AmplifyStorageS3 class is not exported from the package
ackage:amplify_storage_s3/amplify_storage_s3.dart ???
I have 3 ideas.
1: In package import import 'package:amplify_storage_s3/amplify_storage_s3.dart'; add "as ampl" to the end and then you will have something like this:
import 'package:amplify_storage_s3/amplify_storage_s3.dart' as ampl;
And then write:
ampl.AmplifyStorageS3 storage = ampl.AmplifyStorageS3();
2: Hold ctrl and left click on the imported package, find this class in the package and find out what's wrong.
3: Check your pubspec.yaml and so on for minimum requirements:
environment:
sdk: ">=2.12.0 <3.0.0"

How to ignore all lint rules for a file or a project?

I'm seeing too many lint warnings in my file, for example:
Avoid print calls in production code
Prefer const with constant constructors
Use key in widget constructors
I know how to disable a rule for a specific line or for the entire file, but I want to know is there any way I can disable all these lint warnings with something like
// ignore_for_file: all
According to the documentation,
// ignore_for_file: type=lint
should work. I don't have a project to test it right now though.
in your analysis_options.yaml file:
linter:
rules:
avoid_print: false
# add more here ...
# Available lints see: [https://dart-lang.github.io/linter/lints/index.html][1]
Unfortunately, there is no such comment like that. These lint rules are coming from flutter_lints package which is included in your analysis_options.yaml file, So, open the file and comment this line out:
// include: package:flutter_lints/flutter.yaml
After this, save the file using command + s
Just remove flutter_lints package from pubspec.yaml file.

No such module in a Swift Package using Xcode - package listed in dependencies

I create a blank template package:
> swift package init --name Temp
> open Package.swift
Xcode Version 13.2.1 (13C100) opens the package.
I add a dependency to the package.
dependencies: [
.package(url: "https://github.com/johnsundell/publish.git", from: "0.7.0")
],
Xcode > Product > Build succeeds at this point.
I edit Temp/Sources/Temp/Temp.swift to insert the first line the package that is defined in dependencies.
import Publish
A build now generates the following error:…/Temp/Sources/Temp/Temp.swift:1:8: error: no such module 'Publish'.
I feel certain this is an Apple bug. Or I could be missing something.
There are several posts about this problem when there is an xcodeproj and the additional structure that provides. Some of them hint at workarounds that help some people.
Has anyone seen this and/or know of how to resolve it?
Apple's Creating a Standalone Swift Package with Xcode document doesn't provide any insight.
thanks for the chatter in the comments, #Larme & #koen, it helped
The issue was user error (and/or a documentation lapse). Living on the (bleeding) edge.
Sometimes updates from changes are slow or require a clean or a relaunch.
Xcode auto-generates Schemes from the targets defined in your package. My build was targeting MyTarget.
Two things were missing:
name: "Publish" was not included in the package dependency - it's needed so you can reference it below (or maybe this can be derived, it's hard to tell because of Xcode refresh issues), and
a reference is needed in the dependencies for each target using the package-dependency, i needed to add dependencies: ["Publish"] in the related target
dependencies: [
.package(name: "Publish", url: "https://github.com/johnsundell/publish.git", from: "0.7.0")
],
…
targets: [
.target(
name: "MyTarget",
dependencies: ["Publish"]),
]

Flutter desktop - change window title from Dart code

I am unable to find any way to do that when searching official documentation. Does anybody know any way to do that?
It is possible, as mentioned in https://github.com/flutter/flutter/issues/30712
In pubspec.yaml add
dependencies:
window_size:
git:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: fd519be1e8398c6b6c2062c2447bac960a71bc02
Now in your code just call
import 'package:window_size/window_size.dart';
setWindowTitle("Custom window title");
Works fine on Linux. Haven't tested on Windows/Mac
Go to windows > runner > main.cpp folder, find a
" !window.CreateAndShow(L"schedule_task", origin, size) "
And change the "schedule_task" text
Ok, that seems to be not possible (yet), but work in progress: https://github.com/flutter/flutter/issues/30712

IONIC 3: Plugin BackgroundMode dont work: Object(…) is not a function

I need to run the code “this.backgroundMode.enable()” in my project, but it shows me the following error:
"Object(...) is not a function"
It imports it in app.module.ts in the following way:
import {BackgroundMode} from '# ionic-native / background-mode / ngx';
...
providers: [
...
BackgroundMode
...]
And in the page (in my case is in app.component.ts, after deviceready, like the official documentation says) i use like:
import {BackgroundMode} from '# ionic-native / background-mode / ngx';
constructor(private backgroundMode: BackgroundMode) { }
...
this.backgroundMode.enable();
Please I need to run this plugin in my project
I have answered a similar question here https://stackoverflow.com/a/54398403/6617276
Check your project type in ionic.config.json file.
If the type is "ionic-angular", then install 4.x.x version.
npm i -s #ionic-native/background-mode#4.20.0
If the type is "angular", then install 5.x.x-beta version
npm i -s #ionic-native/background-mode#5.0.0-beta.24
Note:
Add ngx at the end of import only if you are using Angular 6
import { BackgroundMode } from '#ionic-native/background-mode/ngx';
if not remove ngx from the import both in app.module.ts and app.component.ts
import { BackgroundMode } from '#ionic-native/background-mode';