mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
region and access_management ui
This commit is contained in:
36
lib/services/access_mang_api.dart
Normal file
36
lib/services/access_mang_api.dart
Normal file
@ -0,0 +1,36 @@
|
||||
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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user