Skip to content

Commit 7f67fc2

Browse files
committed
error fixed
1 parent 09e5732 commit 7f67fc2

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "interactive"
3+
}

example/lib/main.dart

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ class _MyAppState extends State<MyApp> {
1515
LiveIcon liveIcon = LiveIcon();
1616

1717
@override
18-
void initState() async {
18+
void initState() {
1919
super.initState();
20+
initialize();
21+
}
22+
23+
void initialize() async {
2024
await liveIcon.initialize(icons: [
2125
const LiveIconData(
2226
iconName: "darkTheme",
@@ -37,7 +41,12 @@ class _MyAppState extends State<MyApp> {
3741
title: const Text('Plugin example app'),
3842
),
3943
body: Center(
40-
child: Text(''),
44+
child: ElevatedButton(
45+
child: Text('Initialize'),
46+
onPressed: () {
47+
initialize();
48+
},
49+
),
4150
),
4251
),
4352
);

lib/live_icon.dart

+6-10
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ class LiveIcon {
1515
}
1616

1717
List<Map<String, String>> _serializeLiveIconData(List<LiveIconData> icons) {
18-
List<Map<String, String>> iconData;
19-
for (LiveIconData icon in icons) {
20-
iconData.add(
21-
<String, String>{
22-
'iconName': icon.iconName,
23-
'className': icon.className,
24-
},
25-
);
26-
}
27-
return iconData;
18+
return icons
19+
.map((icon) => <String, String>{
20+
'iconName': icon.iconName,
21+
'className': icon.className,
22+
})
23+
.toList();
2824
}
2925
}

0 commit comments

Comments
 (0)