123 lines
4.1 KiB
Dart
123 lines
4.1 KiB
Dart
// // import 'dart:convert';
|
|
|
|
// // import 'package:flutter/material.dart';
|
|
// // import 'package:flutter_eval/flutter_eval.dart';
|
|
// // import 'package:konectar_events/utils/constants.dart';
|
|
|
|
// // class NewApp extends StatefulWidget {
|
|
// // String fileJson;
|
|
// // NewApp({super.key, required this.fileJson});
|
|
|
|
// // @override
|
|
// // State<NewApp> createState() => _NewAppState();
|
|
// // }
|
|
|
|
// // class _NewAppState extends State<NewApp> {
|
|
// // @override
|
|
// // Widget build(BuildContext context) {
|
|
// // return Directionality(
|
|
// // textDirection: TextDirection.ltr,
|
|
// // child: Scaffold(
|
|
// // body: EvalExample(
|
|
// // fileJson: widget.fileJson,
|
|
// // )));
|
|
// // }
|
|
// // }
|
|
|
|
// // class EvalExample extends StatelessWidget {
|
|
// // String fileJson;
|
|
// // EvalExample({Key? key, required this.fileJson}) : super(key: key);
|
|
|
|
// // @override
|
|
// // Widget build(BuildContext context) {
|
|
// // return EvalWidget(
|
|
// // packages: {
|
|
// // 'example': {'flutter_eval.dart': fileJson}
|
|
// // },
|
|
|
|
// // /// In debug mode, flutter_eval will continually re-generate a compiled
|
|
// // /// EVC bytecode file for the given program, and save it to the specified
|
|
// // /// assetPath. During runtime, it will instead load the compiled EVC file.
|
|
// // /// To ensure this works, you must add the file path to the assets section of
|
|
// // /// your pubspec.yaml file.
|
|
// // assetPath: 'assets/program.evc',
|
|
|
|
// // /// Specify which library (i.e. which file) to use as an entrypoint.
|
|
// // library: 'package:konectar_events/flutter_eval.dart',
|
|
|
|
// // /// Specify which function to call as the entrypoint.
|
|
// // /// To use a constructor, use "ClassName.constructorName" syntax. In
|
|
// // /// this case we are calling a default constructor so the constructor
|
|
// // /// name is blank.
|
|
// // function: 'MyApp.',
|
|
|
|
// // /// Specify the arguments to pass to the entrypoint. Generally these
|
|
// // /// should be dart_eval [$Value] objects, but when invoking a static or
|
|
// // /// top-level function or constructor, [int]s, [double]s, and [bool]s
|
|
// // /// should be passed directly.
|
|
// // args: [null],
|
|
// // );
|
|
// // }
|
|
// // }
|
|
|
|
// import 'dart:convert';
|
|
|
|
// import 'package:dio/dio.dart';
|
|
// import 'package:firebase_remote_config/firebase_remote_config.dart';
|
|
// import 'package:flutter/material.dart';
|
|
// import 'package:flutter/services.dart';
|
|
// import 'package:mirai/mirai.dart';
|
|
|
|
// class MyApp extends StatelessWidget {
|
|
// String client;
|
|
// MyApp({super.key, required this.client});
|
|
|
|
// Widget build(BuildContext context) {
|
|
// return MiraiApp(
|
|
// title: 'Sdui Example',
|
|
// homeBuilder: (context) {
|
|
// return FutureBuilder(
|
|
// future: DataService.getJson(client),
|
|
// builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
// return Mirai.fromJson(snapshot.data, context) ??
|
|
// const MaterialApp(
|
|
// home: Scaffold(
|
|
// body: Center(child: CircularProgressIndicator())));
|
|
// },
|
|
// );
|
|
// },
|
|
// );
|
|
// }
|
|
// }
|
|
|
|
// class DataService {
|
|
// static final Dio _dio = Dio();
|
|
|
|
// static Future<Map<String, dynamic>> getJson(String client) async {
|
|
// try {
|
|
// //Replace this to your own url server
|
|
// final remoteConfig = FirebaseRemoteConfig.instance;
|
|
// await remoteConfig.fetchAndActivate();
|
|
// String def;
|
|
// if (client == "clientA") {
|
|
// def = "miraijsonA";
|
|
// } else {
|
|
// def = "miraijsonB";
|
|
// }
|
|
// String rawData = remoteConfig.getString(def);
|
|
// print(rawData);
|
|
// const jsonString =
|
|
// '{"text": "foo", "value": 1, "status": false, "extra": null}';
|
|
// dynamic map = jsonDecode(rawData);
|
|
// print("check");
|
|
// print(map);
|
|
// dynamic jsonResultc2 =
|
|
// jsonDecode(await rootBundle.loadString("assets/response.json"));
|
|
|
|
// return map;
|
|
// } catch (e) {
|
|
// throw Exception('Error getting data: $e');
|
|
// }
|
|
// }
|
|
// }
|
|
|