关于这个问题我似乎没有任何错误.我已经在app.module.ts中导入并将其放入'声明'中.
在app.module.ts中
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
//ionic-native
import { NativeStorage } from '@ionic-native/native-storage';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
//pipe
import { HoursMinutesSecondsPipe } from '../pipes/hours-minutes-
seconds/hours-minutes-seconds';
@NgModule({
declarations: [
MyApp,
HoursMinutesSecondsPipe
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp, {
platforms: {
android: {
tabsPlacement: 'top'
}
}
}),
],
bootstrap: [IonicApp],
entryComponents: …Run Code Online (Sandbox Code Playgroud) 我是 Flutter 新手。\n我想从列表变量中显示 DropdownMenuItem。\n查看我的代码。
\n\n\n// my list variable\n\n\n List listUserType = [\n {'name': 'Individual', 'value': 'individual'},\n {'name': 'Company', 'value': 'company'}\n ];\n\n\n\n\n// items property in DropdownMenuItem\n\nreturn DropdownButtonFormField<List<Map>>(\n decoration: InputDecoration(\n prefixIcon: Icon(Icons.settings),\n hintText: 'Organisation Type',\n filled: true,\n fillColor: Colors.white,\n errorStyle: TextStyle(color: Colors.yellow),\n ),\n items: listUserType.map((map) {\n return DropdownMenuItem(\n child: Text(map['name']),\n value: map['value'],\n );\n }).toList());\nRun Code Online (Sandbox Code Playgroud)\n\n这是我得到的结果
\n\nI/flutter (22528): \xe2\x95\x90\xe2\x95\x90\xe2\x95\xa1 EXCEPTION CAUGHT BY WIDGETS LIBRARY \xe2\x95\x9e\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\nI/flutter (22528): The following assertion was thrown building RegisterPage(dirty, state: RegisterPageState#5b83a):\nI/flutter (22528): type 'List<DropdownMenuItem<dynamic>>' is not …Run Code Online (Sandbox Code Playgroud)