Flutter Program Works on Web but Not Running on Android Device

Issue

This Flutter program works in on the Web, but doesn’t on Android

How do I fix the code to run this on Android Device.

import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import 'dart:html';

void main() => runApp(MaterialApp(home: MyApp()));

class MyApp extends StatefulWidget {
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<TextEditingController> controllers = [TextEditingController()];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          ...List.generate(
            controllers.length,
            (index) => TextField(
              autofocus: true,
              controller: controllers[index],
              onSubmitted: (v) {
                controllers.add(TextEditingController());
                setState(() {});
              },
            ),
          ),
        ],
      ),
    );
  }
}

THIS IS THE ERROR I AM GETTING – https://pastebin.com/KmcHFs1X

Solution

i have experienced it,looks like this can help
enter link description here

Answered By – onair

Answer Checked By – Candace Johnson (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *