/*
 * @Author: XianKaiQun
 * @Date: 2020-07-29 09:05:00
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-10 16:27:10
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/impl/security_service_impl.dart';
import 'package:qrcode_package/src/models/security_record.dart';

class PrivateSecurityDetailStore with ChangeNotifier {
  final BuildContext context, providerContext;
  late Map<String, dynamic> routingArgs;
  PrivateSecurityDetailStore(this.context, this.providerContext) {
    routingArgs = (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>? ??
        {};
  }

  String? get id => routingArgs['id'];

  SecurityRecordModel? data;

  getData() async {
    final res = await SecurityServiceImpl.instance!.getSecurityDetail(id);
    data = res.data ?? SecurityRecordModel();
    notifyListeners();
  }
}
