Skip to content

Instantly share code, notes, and snippets.

@Bruising6802
Created March 2, 2020 21:11
Show Gist options
  • Save Bruising6802/45bd7fe8d23ddcdd5e051eef7c7bb54a to your computer and use it in GitHub Desktop.
Save Bruising6802/45bd7fe8d23ddcdd5e051eef7c7bb54a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'dart:convert';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
static String _widget = Text('D').toString();
static String rawJson = """{"widget":"L($_widget..replaceAll(" ", ' '))L"}""";
static Map<String, dynamic> map = jsonDecode(rawJson);
static String widgete = map['widget'];
WidgetJson widgetJson = WidgetJson(widget: widgete);
@override
Widget build(BuildContext context) {
print(_widget);
return Scaffold(
appBar: AppBar(
title: Text("Widget Title"),
),
body: Stack(
children: <Widget>[Text("$widgete")],
),
);
}
}
class WidgetJson {
WidgetJson({this.widget});
String widget;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment