2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

More cleanup

This commit is contained in:
Oliver
2021-07-15 23:28:55 +10:00
parent d2ce3fadf1
commit 83e29777c2
12 changed files with 23 additions and 60 deletions

View File

@ -19,12 +19,8 @@ class InvenTreePageResponse {
}
// Total number of results in the dataset
int _count = 0;
void set count(int v) { _count = v; }
int get count => _count;
int count = 0;
int get length => results.length;
List<InvenTreeModel> results = [];

View File

@ -48,9 +48,7 @@ class InvenTreePartCategory extends InvenTreeModel {
InvenTreePartCategory() : super();
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
}
InvenTreePartCategory.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {
@ -85,8 +83,7 @@ class InvenTreePartTestTemplate extends InvenTreeModel {
InvenTreePartTestTemplate() : super();
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
}
InvenTreePartTestTemplate.fromJson(Map<String, dynamic> json) : super.fromJson(json);
@override
InvenTreeModel createFromJson(Map<String, dynamic> json) {
@ -309,11 +306,6 @@ class InvenTreePart extends InvenTreeModel {
name: 'image',
);
if (response == null) {
print("uploadImage returned null at '${url}'");
return false;
}
if (response.statusCode != 200) {
print("uploadImage returned ${response.statusCode} at '${url}'");
return false;

View File

@ -1,12 +1,8 @@
import 'dart:io';
import 'package:device_info/device_info.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:package_info/package_info.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:one_context/one_context.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:InvenTree/api.dart';
@ -108,13 +104,14 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
}
});
final sentryId = await Sentry.captureMessage(message).catchError((error) {
try {
await Sentry.captureMessage(message);
return true;
} catch (error) {
print("Error uploading sentry messages...");
print(error);
return null;
});
return sentryId != null;
return false;
}
}

View File

@ -188,11 +188,11 @@ class InvenTreeStockItem extends InvenTreeModel {
"result": result.toString(),
};
if (value != null && !value.isEmpty) {
if (value != null && value.isNotEmpty) {
data["value"] = value;
}
if (notes != null && !notes.isEmpty) {
if (notes != null && notes.isNotEmpty) {
data["notes"] = notes;
}
@ -211,8 +211,6 @@ class InvenTreeStockItem extends InvenTreeModel {
// Check that the HTTP status code is HTTP_201_CREATED
return _uploadResponse.statusCode == 201;
}
return false;
}
String get uid => jsondata['uid'] ?? '';