mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
36 lines
1.3 KiB
Dart
36 lines
1.3 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/services.dart';
|
|
import 'package:syncrow_web/pages/access_management/model/access_manag_model.dart';
|
|
import 'package:syncrow_web/pages/auth/model/user_model.dart';
|
|
import 'package:syncrow_web/services/api/http_service.dart';
|
|
import 'package:syncrow_web/utils/constants/api_const.dart';
|
|
|
|
class AccessMangApi{
|
|
|
|
// Future<List<AccessManagModel>> fetchInfo() async {
|
|
// final response = await HTTPService().get(
|
|
// path: '/Users/mohammad/StudioProjects/web_auth/assets/demo.json',
|
|
// showServerMessage: true,
|
|
// expectedResponseModel: (json) {
|
|
// print('fetchInfo=$json');
|
|
// return (json as List).map((item) => AccessManagModel.fromJson(item)).toList();
|
|
// },
|
|
// );
|
|
// return response;
|
|
// }
|
|
|
|
Future<List<AccessManagModel>> fetchInfo() async {
|
|
// Load the JSON file
|
|
final jsonString = await rootBundle.loadString('assets/dome.json');
|
|
|
|
// Parse the JSON string
|
|
final List<dynamic> jsonList = json.decode(jsonString);
|
|
print('jsonList=${jsonList.runtimeType}');
|
|
print('jsonList=${jsonList}');
|
|
// Convert the list of JSON objects to a list of AccessManagModel instances
|
|
final List<AccessManagModel> accessList = jsonList.map((item) => AccessManagModel.fromJson(item)).toList();
|
|
|
|
return accessList;
|
|
}
|
|
} |