2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

.empty() -> []

Turns out .empty() creates an empty list which is fixed length!
This commit is contained in:
Oliver 2021-07-13 00:13:38 +10:00
parent dd39b98ae9
commit 40613c9c36
11 changed files with 16 additions and 16 deletions

View File

@ -307,7 +307,7 @@ class InvenTreeModel {
var response = await api.get(URL, params: params);
// A list of "InvenTreeModel" items
List<InvenTreeModel> results = new List<InvenTreeModel>.empty();
List<InvenTreeModel> results = [];
if (response == null) {
return results;

View File

@ -149,7 +149,7 @@ class InvenTreePart extends InvenTreeModel {
}
// Cached list of stock items
List<InvenTreeStockItem> stockItems = List<InvenTreeStockItem>.empty();
List<InvenTreeStockItem> stockItems = [];
int get stockItemCount => stockItems.length;
@ -175,7 +175,7 @@ class InvenTreePart extends InvenTreeModel {
int get supplier_count => (jsondata['suppliers'] ?? 0) as int;
// Cached list of test templates
List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>.empty();
List<InvenTreePartTestTemplate> testingTemplates = [];
int get testTemplateCount => testingTemplates.length;
@ -277,7 +277,7 @@ class InvenTreePart extends InvenTreeModel {
if (fn.isNotEmpty) return fn;
List<String> elements = List<String>.empty();
List<String> elements = [];
if (IPN.isNotEmpty) elements.add(IPN);

View File

@ -138,7 +138,7 @@ class InvenTreeStockItem extends InvenTreeModel {
// TODO
}
List<InvenTreePartTestTemplate> testTemplates = List<InvenTreePartTestTemplate>.empty();
List<InvenTreePartTestTemplate> testTemplates = [];
int get testTemplateCount => testTemplates.length;
@ -159,7 +159,7 @@ class InvenTreeStockItem extends InvenTreeModel {
});
}
List<InvenTreeStockItemTestResult> testResults = List<InvenTreeStockItemTestResult>.empty();
List<InvenTreeStockItemTestResult> testResults = [];
int get testResultCount => testResults.length;

View File

@ -26,7 +26,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
final GlobalKey<FormState> _addProfileKey = new GlobalKey<FormState>();
List<UserProfile> profiles = new List<UserProfile>.empty();
List<UserProfile> profiles = [];
_InvenTreeLoginSettingsState() {
_reload();

View File

@ -133,7 +133,7 @@ class UserProfileDBManager {
final profiles = await store.find(await _db);
List<UserProfile> profileList = new List<UserProfile>.empty();
List<UserProfile> profileList = [];
for (int idx = 0; idx < profiles.length; idx++) {
@ -158,7 +158,7 @@ class UserProfileDBManager {
final profiles = await store.find(await _db);
List<UserProfile> profileList = new List<UserProfile>.empty();
List<UserProfile> profileList = [];
for (int idx = 0; idx < profiles.length; idx++) {

View File

@ -130,7 +130,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
// The local InvenTreePartCategory object
final InvenTreePartCategory? category;
List<InvenTreePartCategory> _subcategories = List<InvenTreePartCategory>.empty();
List<InvenTreePartCategory> _subcategories = [];
@override
Future<void> onBuild(BuildContext context) async {

View File

@ -107,7 +107,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
List<Widget> _companyTiles() {
var tiles = List<Widget>.empty();
List<Widget> tiles = [];
bool sep = false;

View File

@ -39,9 +39,9 @@ class CustomerListWidget extends CompanyListWidget {
class _CompanyListState extends RefreshableState<CompanyListWidget> {
var _companies = new List<InvenTreeCompany>.empty();
List<InvenTreeCompany> _companies = [];
var _filteredCompanies = new List<InvenTreeCompany>.empty();
List<InvenTreeCompany> _filteredCompanies = [];
String _title = "Companies";

View File

@ -220,7 +220,7 @@ void showFormDialog(String title, {String? acceptText, String? cancelText, Globa
];
}
var _fields = fields ?? List<Widget>.empty();
List<Widget> _fields = fields ?? [];
OneContext().showDialog(
builder: (BuildContext context) {

View File

@ -128,7 +128,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
_LocationDisplayState(this.location) {}
List<InvenTreeStockLocation> _sublocations = List<InvenTreeStockLocation>.empty();
List<InvenTreeStockLocation> _sublocations = [];
String _locationFilter = '';

View File

@ -296,7 +296,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
)
),
suggestionsCallback: (pattern) async {
var suggestions = List<InvenTreeStockLocation>.empty();
List<InvenTreeStockLocation> suggestions = [];
for (var loc in locations) {
if (loc.matchAgainstString(pattern)) {