Unknown Error with Custom Widget Code

Widgets & Design

I am trying to build a simple accordion style widget with using custom code, but I am always getting an "Unknown error compiling custom code. A common cause is a custom widget or action whose name in the code does not match the name provided in the editor.", but with no indication from the editor itself as to what is wrong.

As far as I can tell, the code itself is pure Dart/Flutter and I don't rely on any non-standard dependencies.

I have double-checked that the name of my custom widget, FFAccordion, matches that within the actual code, but I am still seeing this error. Any help would be greatly appreciated.

// Automatic FlutterFlow imports
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

class FFAccordion extends StatelessWidget {
  final List<String> headers;
  final List<Widget> bodies;

  const FFAccordion({
    Key? key,
    required this.headers,
    required this.bodies,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    assert(headers.length == bodies.length,
        'headers and bodies length must match');

    return SingleChildScrollView(
      child: ExpansionPanelList.radio(
        animationDuration: const Duration(milliseconds: 250),
        children: List.generate(headers.length, (i) {
          return ExpansionPanelRadio(
            value: i, // radio → ensures 1‑open‑at‑a‑time
            headerBuilder: (ctx, isOpen) => ListTile(
              title: Text(headers[i],
                  style: Theme.of(context)
                      .textTheme
                      .titleMedium!
                      .copyWith(fontWeight: FontWeight.bold)),
            ),
            body: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
              child: bodies[i],
            ),
          );
        }),
      ),
    );
  }
}
What have you tried so far?

I have asked ChatGPT several times and looked through forum posts with the same theme/topic

Did you check FlutterFlow's Documentation for this topic?
Yes
1