Custom Widget Error - Implementing flutter_map package from pub.dev

Resolved

I'm attempting to build a custom widget in FlutterFlow using the flutter_map package from pub.dev. I think I'm getting pretty close to having the basic build working, but it is throwing an error that I don't understand how to fix (see the error below). This error is coming from the "layers" parameter within the custom widget near the bottom.

Error

"The named parameter 'layers' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'layers'."

Code

import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart' as ltlng;

class FlutterMapTest extends StatefulWidget {
  const FlutterMapTest({Key? key, this.width, this.height, this.layers})
      : super(key: key);

  final double? width;
  final double? height;

  @override
  _FlutterMapTestState createState() => _FlutterMapTestState();
}

class _FlutterMapTestState extends State<FlutterMapTest> {

  @override
  Widget build(BuildContext context) {
    return Column(children: <Widget>[
      FlutterMap(
          mapController: MapController(),
          options: MapOptions(),
          children: [],
          layers: TileLayer(
            urlTemplate:
                "***",
            additionalOptions: {
              'accessToken':
                  "***",
            },
          ))
    ]);
  }
}

Pubspec Dependencies flutter_map: ^4.0.0

2
11 replies