mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
26 lines
619 B
Dart
26 lines
619 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import '../model/device_model.dart';
|
|
|
|
part 'devices_state.dart';
|
|
|
|
class DevicesCubit extends Cubit<DevicesState> {
|
|
DevicesCubit() : super(DevicesInitial()) {
|
|
getDevices();
|
|
}
|
|
|
|
//TODO separate the navigation logic to another cubit
|
|
static DevicesCubit get(context) => BlocProvider.of(context);
|
|
|
|
var devices = <DeviceModel>[];
|
|
|
|
Future<List<DeviceModel>> getDevices() async {
|
|
emit(DevicesLoading());
|
|
await Future.delayed(const Duration(seconds: 2));
|
|
emit(DevicesSuccess());
|
|
|
|
return devices = [];
|
|
}
|
|
}
|