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:
parent
dd39b98ae9
commit
40613c9c36
@ -307,7 +307,7 @@ class InvenTreeModel {
|
|||||||
var response = await api.get(URL, params: params);
|
var response = await api.get(URL, params: params);
|
||||||
|
|
||||||
// A list of "InvenTreeModel" items
|
// A list of "InvenTreeModel" items
|
||||||
List<InvenTreeModel> results = new List<InvenTreeModel>.empty();
|
List<InvenTreeModel> results = [];
|
||||||
|
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
return results;
|
return results;
|
||||||
|
@ -149,7 +149,7 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cached list of stock items
|
// Cached list of stock items
|
||||||
List<InvenTreeStockItem> stockItems = List<InvenTreeStockItem>.empty();
|
List<InvenTreeStockItem> stockItems = [];
|
||||||
|
|
||||||
int get stockItemCount => stockItems.length;
|
int get stockItemCount => stockItems.length;
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
int get supplier_count => (jsondata['suppliers'] ?? 0) as int;
|
int get supplier_count => (jsondata['suppliers'] ?? 0) as int;
|
||||||
|
|
||||||
// Cached list of test templates
|
// Cached list of test templates
|
||||||
List<InvenTreePartTestTemplate> testingTemplates = List<InvenTreePartTestTemplate>.empty();
|
List<InvenTreePartTestTemplate> testingTemplates = [];
|
||||||
|
|
||||||
int get testTemplateCount => testingTemplates.length;
|
int get testTemplateCount => testingTemplates.length;
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ class InvenTreePart extends InvenTreeModel {
|
|||||||
|
|
||||||
if (fn.isNotEmpty) return fn;
|
if (fn.isNotEmpty) return fn;
|
||||||
|
|
||||||
List<String> elements = List<String>.empty();
|
List<String> elements = [];
|
||||||
|
|
||||||
if (IPN.isNotEmpty) elements.add(IPN);
|
if (IPN.isNotEmpty) elements.add(IPN);
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
List<InvenTreePartTestTemplate> testTemplates = List<InvenTreePartTestTemplate>.empty();
|
List<InvenTreePartTestTemplate> testTemplates = [];
|
||||||
|
|
||||||
int get testTemplateCount => testTemplates.length;
|
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;
|
int get testResultCount => testResults.length;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
|
|
||||||
final GlobalKey<FormState> _addProfileKey = new GlobalKey<FormState>();
|
final GlobalKey<FormState> _addProfileKey = new GlobalKey<FormState>();
|
||||||
|
|
||||||
List<UserProfile> profiles = new List<UserProfile>.empty();
|
List<UserProfile> profiles = [];
|
||||||
|
|
||||||
_InvenTreeLoginSettingsState() {
|
_InvenTreeLoginSettingsState() {
|
||||||
_reload();
|
_reload();
|
||||||
|
@ -133,7 +133,7 @@ class UserProfileDBManager {
|
|||||||
|
|
||||||
final profiles = await store.find(await _db);
|
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++) {
|
for (int idx = 0; idx < profiles.length; idx++) {
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ class UserProfileDBManager {
|
|||||||
|
|
||||||
final profiles = await store.find(await _db);
|
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++) {
|
for (int idx = 0; idx < profiles.length; idx++) {
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
// The local InvenTreePartCategory object
|
// The local InvenTreePartCategory object
|
||||||
final InvenTreePartCategory? category;
|
final InvenTreePartCategory? category;
|
||||||
|
|
||||||
List<InvenTreePartCategory> _subcategories = List<InvenTreePartCategory>.empty();
|
List<InvenTreePartCategory> _subcategories = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onBuild(BuildContext context) async {
|
Future<void> onBuild(BuildContext context) async {
|
||||||
|
@ -107,7 +107,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||||||
|
|
||||||
List<Widget> _companyTiles() {
|
List<Widget> _companyTiles() {
|
||||||
|
|
||||||
var tiles = List<Widget>.empty();
|
List<Widget> tiles = [];
|
||||||
|
|
||||||
bool sep = false;
|
bool sep = false;
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ class CustomerListWidget extends CompanyListWidget {
|
|||||||
|
|
||||||
class _CompanyListState extends RefreshableState<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";
|
String _title = "Companies";
|
||||||
|
|
||||||
|
@ -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(
|
OneContext().showDialog(
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
|
@ -128,7 +128,7 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
|||||||
|
|
||||||
_LocationDisplayState(this.location) {}
|
_LocationDisplayState(this.location) {}
|
||||||
|
|
||||||
List<InvenTreeStockLocation> _sublocations = List<InvenTreeStockLocation>.empty();
|
List<InvenTreeStockLocation> _sublocations = [];
|
||||||
|
|
||||||
String _locationFilter = '';
|
String _locationFilter = '';
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
suggestionsCallback: (pattern) async {
|
suggestionsCallback: (pattern) async {
|
||||||
var suggestions = List<InvenTreeStockLocation>.empty();
|
List<InvenTreeStockLocation> suggestions = [];
|
||||||
|
|
||||||
for (var loc in locations) {
|
for (var loc in locations) {
|
||||||
if (loc.matchAgainstString(pattern)) {
|
if (loc.matchAgainstString(pattern)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user