JSON.parse to Map howto (new syntax 0.3.1_r17328)



请问以下内容的新语法是什么?

Map mAcctData = JSON.parse(sResponse);    // sResponse is Json String

parse(和stringify)已被移至顶级函数。

import 'dart:json' as JSON;  // note the JSON name
main() {
  var text = // some text...
  var map = JSON.parse(text); // using the JSON name
}

import 'dart:json'; // note, no JSON name
main() {
  var text = // some text...
  var map = parse(text); // calling parse as a top-level function.
}

最新更新