小编Gúb*_*ner的帖子

找不到路线发电机

我是新手,在Flutter中有一个关于路线和分页的例外.

EXCEPTION CAUGHT BY GESTURE
The following assertion was thrown while handling a gesture:
Could not find a generator for route "/listadecompras" in the _MaterialAppState.
Run Code Online (Sandbox Code Playgroud)

请遵循以下代码摘录:

import 'package:flutter/material.dart';

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
// ...                    
                return new ListTile(
                  onTap: () {                                         
                    Navigator.pushNamed(context, "/listadecompras");
                  },
// ...
}


class ListaDeCompras extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
// ...
}
}


void main() {
runApp(new MaterialApp(
    home: new MyApp(), …
Run Code Online (Sandbox Code Playgroud)

flutter

12
推荐指数
4
解决办法
7275
查看次数

DART:实例列表中的indexOf()

如何获取列表中一个实例的索引?

class Points {
  int x, y;
  Point(this.x, this.y);
}

void main() {
  var pts = new List();
  int Lx;
  int Ly;

  Points pt = new Points(25,55); // new instance
  pts.add(pt);

  int index = pts.indexOf(25); // Problem !!! How to obtain the index in a list of instances ?
  if (index != -1 ){
  Lx = lp1.elementAt(index).x;
  Ly = lp1.elementAt(index).y;
  print('X=$Lx Y=$Ly');
}
Run Code Online (Sandbox Code Playgroud)

list indexof dart

7
推荐指数
1
解决办法
1306
查看次数

标签 统计

dart ×1

flutter ×1

indexof ×1

list ×1