Compare commits

..

10 commits

Author SHA1 Message Date
Gorter-dev
f3b1cc99ae
Merge pull request #4 from Iconica-Development/chore/deploy
chore: ready the package for deployment to the pub server
2024-07-22 14:59:58 +02:00
Bart Ribbers
e6a8a29bb6 chore: ready the package for deployment to the pub server 2024-07-19 13:46:15 +02:00
Bart Ribbers
d494836a5e chore: add fvm configuration to gitignore 2024-07-11 19:57:29 +02:00
Freek van de Ven
226ee604d2
Merge pull request #3 from Iconica-Development/update-component-documentation-workflow-correct
Add component-documentation.yml correct
2024-02-14 08:09:25 +01:00
Vick Top
c916907199 feat(documentation): Create component-documentation.yml workflow file 2024-02-13 13:37:48 +01:00
Vick Top
e7c4bd586a chore: Remove old component-documentation.yml 2024-02-13 13:37:48 +01:00
Freek van de Ven
9c287ab904
Merge pull request #2 from Iconica-Development/update-component-documentation-workflow
Add component-documentation.yml
2024-02-12 20:27:25 +01:00
Vick Top
288b8c6d88 feat(documentation): Create component-documentation.yml workflow file 2024-02-12 19:09:46 +01:00
mike doornenbal
f31d873c1b Merge branch 'fix/add_ci_linter' 2024-02-07 09:45:34 +01:00
mike doornenbal
85939335f1 fix: add ci and linter 2024-02-07 09:45:22 +01:00
8 changed files with 107 additions and 38 deletions

View file

@ -0,0 +1,14 @@
name: Iconica Standard Component Documentation Workflow
# Workflow Caller version: 1.0.0
on:
release:
types: [published]
workflow_dispatch:
jobs:
call-iconica-component-documentation-workflow:
uses: Iconica-Development/.github/.github/workflows/component-documentation.yml@master
secrets: inherit
permissions: write-all

14
.github/workflows/compponent-ci.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: Iconica Standard Component CI Workflow
# Workflow Caller version: 2.0.0
on:
pull_request:
workflow_dispatch:
jobs:
call-global-iconica-workflow:
uses: Iconica-Development/.github/.github/workflows/component-ci.yml@master
secrets: inherit
permissions: write-all
with:
subfolder: "." # add optional subfolder to run workflow in

4
.gitignore vendored
View file

@ -28,3 +28,7 @@ migrate_working_dir/
.dart_tool/ .dart_tool/
.packages .packages
build/ build/
# FVM Version Cache
.fvm/
.fvmrc

View file

@ -1,3 +1,7 @@
## 1.0.1
- Added CI and linter
## 1.0.0 ## 1.0.0
- Initial release - Initial release

View file

@ -1,4 +1,9 @@
include: package:flutter_lints/flutter.yaml include: package:flutter_iconica_analysis/analysis_options.yaml
# Additional information about this file can be found at # Possible to overwrite the rules from the package
# https://dart.dev/guides/language/analysis-options
analyzer:
exclude:
linter:
rules:

View file

@ -1,9 +1,10 @@
// SPDX-FileCopyrightText: 2022 Iconica // SPDX-FileCopyrightText: 2022 Iconica
// //
// SPDX-License-Identifier: BSD-3-Clause // SPDX-License-Identifier: BSD-3-Clause
///
library plugin_platform_interface; library plugin_platform_interface;
// ignore: depend_on_referenced_packages
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
/// Base class for data interfaces. /// Base class for data interfaces.
@ -11,20 +12,25 @@ import 'package:meta/meta.dart';
/// Provides a static helper method for ensuring that data interfaces are /// Provides a static helper method for ensuring that data interfaces are
/// implemented using `extends` instead of `implements`. /// implemented using `extends` instead of `implements`.
/// ///
/// Data interface classes are expected to have a private static token object which will be /// Data interface classes are expected to have a private static token object
/// which will be
/// be passed to [verify] along with a data interface object for verification. /// be passed to [verify] along with a data interface object for verification.
/// ///
/// Sample usage: /// Sample usage:
/// ///
/// ///
/// Mockito mocks of data interfaces will fail the verification, in test code only it is possible /// Mockito mocks of data interfaces will fail the verification, in test code
/// to include the [MockDataInterfaceMixin] for the verification to be temporarily disabled. See /// only it is possible
/// [MockDataInterfaceMixin] for a sample of using Mockito to mock a data interface. /// to include the [MockDataInterfaceMixin] for the verification to be
/// temporarily disabled. See
/// [MockDataInterfaceMixin] for a sample of using Mockito to mock a data
/// interface.
abstract class DataInterface { abstract class DataInterface {
/// Constructs a DataInterface, for use only in constructors of abstract /// Constructs a DataInterface, for use only in constructors of abstract
/// derived classes. /// derived classes.
/// ///
/// @param token The same, non-`const` `Object` that will be passed to `verify`. /// @param token The same, non-`const` `Object` that will be passed
/// to `verify`.
DataInterface({required Object token}) { DataInterface({required Object token}) {
_instanceTokens[this] = token; _instanceTokens[this] = token;
} }
@ -69,14 +75,18 @@ abstract class DataInterface {
required bool preventConstObject, required bool preventConstObject,
}) { }) {
if (instance is MockDataInterfaceMixin) { if (instance is MockDataInterfaceMixin) {
bool assertionsEnabled = false; var assertionsEnabled = false;
assert(() { assert(
assertionsEnabled = true; () {
return true; assertionsEnabled = true;
}()); return true;
}(),
'',
);
if (!assertionsEnabled) { if (!assertionsEnabled) {
throw AssertionError( throw AssertionError(
'`MockDataInterfaceMixin` is not intended for use in release builds.'); '`MockDataInterfaceMixin` is not intended for use in release builds.',
);
} }
return; return;
} }
@ -86,7 +96,8 @@ abstract class DataInterface {
} }
if (!identical(token, _instanceTokens[instance])) { if (!identical(token, _instanceTokens[instance])) {
throw AssertionError( throw AssertionError(
'Data interfaces must not be implemented with `implements`'); 'Data interfaces must not be implemented with `implements`',
);
} }
} }
} }

View file

@ -1,21 +1,26 @@
name: flutter_data_interface name: flutter_data_interface
description: Generic data interface package description: Generic data interface package
version: 1.0.0 version: 1.0.1
repository: https://github.com/Iconica-Development/flutter_data_interface repository: https://github.com/Iconica-Development/flutter_data_interface
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
environment: environment:
sdk: '>=2.18.0 <3.0.0' sdk: ">=3.0.0 <4.0.0"
flutter: ">=1.17.0" flutter: ">=1.17.0"
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
mockito: any meta: ">=1.10.0 <2.0.0"
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^2.0.0 mockito: ">=5.4.4 <6.0.0"
flutter_iconica_analysis:
git:
url: https://github.com/Iconica-Development/flutter_iconica_analysis
ref: 6.0.0
flutter: flutter:

View file

@ -99,26 +99,32 @@ class StaticMethodsOnlyMockPlatformInterfaceMixinTest
void main() { void main() {
group('`verify`', () { group('`verify`', () {
test('prevents implementation with `implements`', () { test('prevents implementation with `implements`', () {
expect(() { expect(
SamplePluginPlatform.instance = ImplementsSamplePluginPlatform(); () {
}, throwsA(isA<AssertionError>())); SamplePluginPlatform.instance = ImplementsSamplePluginPlatform();
},
throwsA(isA<AssertionError>()),
);
}); });
test('prevents implmentation with `implements` and `noSuchMethod`', () { test('prevents implmentation with `implements` and `noSuchMethod`', () {
expect(() { expect(
SamplePluginPlatform.instance = () {
ImplementsSamplePluginPlatformUsingNoSuchMethod(); SamplePluginPlatform.instance =
}, throwsA(isA<AssertionError>())); ImplementsSamplePluginPlatformUsingNoSuchMethod();
},
throwsA(isA<AssertionError>()),
);
}); });
test('allows mocking with `implements`', () { test('allows mocking with `implements`', () {
final SamplePluginPlatform mock = SamplePluginPlatform mock =
ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin(); ImplementsSamplePluginPlatformUsingMockPlatformInterfaceMixin();
SamplePluginPlatform.instance = mock; SamplePluginPlatform.instance = mock;
}); });
test('allows faking with `implements`', () { test('allows faking with `implements`', () {
final SamplePluginPlatform fake = SamplePluginPlatform fake =
ImplementsSamplePluginPlatformUsingFakePlatformInterfaceMixin(); ImplementsSamplePluginPlatformUsingFakePlatformInterfaceMixin();
SamplePluginPlatform.instance = fake; SamplePluginPlatform.instance = fake;
}); });
@ -128,23 +134,29 @@ void main() {
}); });
test('prevents `const Object()` token', () { test('prevents `const Object()` token', () {
expect(() { expect(
ConstTokenPluginPlatform.instance = ExtendsConstTokenPluginPlatform(); () {
}, throwsA(isA<AssertionError>())); ConstTokenPluginPlatform.instance = ExtendsConstTokenPluginPlatform();
},
throwsA(isA<AssertionError>()),
);
}); });
}); });
// Tests of the earlier, to-be-deprecated `verifyToken` method // Tests of the earlier, to-be-deprecated `verifyToken` method
group('`verifyToken`', () { group('`verifyToken`', () {
test('prevents implementation with `implements`', () { test('prevents implementation with `implements`', () {
expect(() { expect(
VerifyTokenPluginPlatform.instance = () {
ImplementsVerifyTokenPluginPlatform(); VerifyTokenPluginPlatform.instance =
}, throwsA(isA<AssertionError>())); ImplementsVerifyTokenPluginPlatform();
},
throwsA(isA<AssertionError>()),
);
}); });
test('allows mocking with `implements`', () { test('allows mocking with `implements`', () {
final VerifyTokenPluginPlatform mock = VerifyTokenPluginPlatform mock =
ImplementsVerifyTokenPluginPlatformUsingMockPlatformInterfaceMixin(); ImplementsVerifyTokenPluginPlatformUsingMockPlatformInterfaceMixin();
VerifyTokenPluginPlatform.instance = mock; VerifyTokenPluginPlatform.instance = mock;
}); });