Skip to content

从js中获取数据不对 #280

@zmtzawqlp

Description

@zmtzawqlp

获取的是空的map, js 端用 plugin 传过来是有 map。

但是

var result = _functions?['runtimeParseVar']?.call({name: ''});
这个地方返回的是 空map

@FairPatch()
class SugarDemo extends StatefulWidget {
  const SugarDemo({
    super.key,
    required this.fairProps,
  });

  final Map<String, dynamic> fairProps;

  @override
  State<SugarDemo> createState() => _SugarDemoState();
}

class _SugarDemoState extends State<SugarDemo> {
  @FairProps()
  var fairProps;
  final String _pageName = '#FairKey#';
  var _list = [];
  @override
  void initState() {
    super.initState();
    fairProps = widget.fairProps;
    onLoad();
  }

  void onLoad() {
    _list.add({'ddd': 1});
    setState(() {});
  }

  
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('test'),
      ),
      body: Column(
        children: Sugar.map<Widget, dynamic>(_list, builder: (item) {
          return Text('$item');
        }),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions