1
0
mirror of https://github.com/flutter/samples.git synced 2026-05-09 08:27:19 +00:00

[linting_tool] Implement saving rules to DB (#860)

This commit is contained in:
Abdullah Deshmukh
2021-08-05 03:48:22 +05:30
committed by GitHub
parent 1818925286
commit bbb8e342f1
22 changed files with 1045 additions and 24 deletions

View File

@@ -8,9 +8,13 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:linting_tool/model/rule.dart';
import 'package:linting_tool/repository/repository.dart';
import 'package:http/http.dart' as http;
class RuleStore extends ChangeNotifier {
RuleStore() {
late final Repository repository;
RuleStore(http.Client httpClient) {
repository = Repository(httpClient);
fetchRules();
}
bool _isLoading = true;
@@ -29,7 +33,7 @@ class RuleStore extends ChangeNotifier {
if (!_isLoading) _isLoading = true;
notifyListeners();
try {
var rules = await Repository().getRulesList();
var rules = await repository.getRulesList();
_rules = rules;
} on SocketException catch (e) {
log(e.toString());