mirror of
https://github.com/foss42/apidash.git
synced 2025-05-23 01:06:46 +08:00
Move uuid to utils
This commit is contained in:
@ -1,11 +1,9 @@
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
|
||||||
import '../models/models.dart';
|
import '../models/models.dart';
|
||||||
import '../services/services.dart';
|
import '../services/services.dart';
|
||||||
|
import '../utils/utils.dart' show uuid;
|
||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
|
|
||||||
const _uuid = Uuid();
|
|
||||||
|
|
||||||
final hiveHandler = HiveHandler();
|
final hiveHandler = HiveHandler();
|
||||||
|
|
||||||
final StateNotifierProvider<ThemeStateNotifier, bool> darkModeProvider =
|
final StateNotifierProvider<ThemeStateNotifier, bool> darkModeProvider =
|
||||||
@ -68,7 +66,7 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>?> {
|
|||||||
|
|
||||||
String add() {
|
String add() {
|
||||||
final newRequestModel = RequestModel(
|
final newRequestModel = RequestModel(
|
||||||
id: _uuid.v1(),
|
id: uuid.v1(),
|
||||||
);
|
);
|
||||||
state = [newRequestModel, ...state!];
|
state = [newRequestModel, ...state!];
|
||||||
return newRequestModel.id;
|
return newRequestModel.id;
|
||||||
@ -90,7 +88,7 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>?> {
|
|||||||
void duplicate(String id) {
|
void duplicate(String id) {
|
||||||
final idx = idxOfId(id);
|
final idx = idxOfId(id);
|
||||||
final newModel = state![idx].duplicate(
|
final newModel = state![idx].duplicate(
|
||||||
id: _uuid.v1(),
|
id: uuid.v1(),
|
||||||
);
|
);
|
||||||
state = [
|
state = [
|
||||||
...state!.sublist(0, idx + 1),
|
...state!.sublist(0, idx + 1),
|
||||||
@ -175,7 +173,7 @@ class CollectionStateNotifier extends StateNotifier<List<RequestModel>?> {
|
|||||||
if (ids == null) {
|
if (ids == null) {
|
||||||
state = [
|
state = [
|
||||||
RequestModel(
|
RequestModel(
|
||||||
id: _uuid.v1(),
|
id: uuid.v1(),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user